home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / basic / altqb551.zip / TOOLBOX.DOC < prev   
Text File  |  1992-11-20  |  170KB  |  4,323 lines

  1.  
  2.             Assembly-Language Toolbox for QuickBASIC
  3.             ────────────────────────────────────────
  4.                        By Christy Gemmell
  5.  
  6. The Assembly-Language Toolbox started life, five years ago, as a simple
  7. collection of useful routines for adding zip to my QuickBASIC programs.
  8. They weren't just pretty faces however. In order to qualify, the Toolbox
  9. routines had to work reliably with real-life commercial applications, the
  10. ones on which my living depended. This made for pretty tough testing, but
  11. those which did survive were, in consequence, fast, robust and, above all,
  12. able to do the job. They are, in fact, doing so in Accountants and Stock-
  13. broker's offices, all over my native Great Britain.
  14.  
  15. A colleague uploaded a copy of the Toolbox onto a local BBS (Electronic
  16. Bulletin Board) and suddenly I started getting letters and phone calls
  17. from complete strangers asking for a copy of the latest version. Nearly
  18. everyone who called had suggestions of their own, remarking; "You know, if
  19. only the Toolbox had this, it would be really good...".
  20.  
  21. Wherever practicable, the good ideas (and some were brilliant) were turned
  22. into assembler code and added to the collection. Almost before I realised
  23. what was happening, the Assembly-Language Toolbox was on the Shareware
  24. circuit and being used by programmers in Europe, the USA, Canada,
  25. Australia and Japan. By December 1990 it had gone through four 'official'
  26. releases and a dozen or more unofficial ones.
  27.  
  28. Release Five comes in two flavours; one for QuickBASIC 4 and the other for
  29. Microsoft's BASIC 7 Professional Development System. The QB4 version
  30. covers QuickBASIC 4.0, 4.5 and BASIC 6 while the PDS version is compatible
  31. with BASIC 7, 7.1 and Extended QuickBASIC (QBX). In either version the
  32. routines are provided both as stand-alone libraries and as Quick Libraries
  33. for use in the programming environment.
  34.  
  35. Using the Toolbox is easy. All the routines are written to look like
  36. standard QuickBASIC SUB programs and FUNCTION procedures. All you have to
  37. do is choose the ones you want to use in your current program and paste
  38. the appropriate DECLARE statements (a full set is provided) into the
  39. source code. If you need to output large quantities of text to the screen
  40. at high speed, for example, just copy the following line from ALTQUICK.DEF.
  41.  
  42. DECLARE SUB FastPrint (BYVAL Row%, BYVAL Col%, Text$, BYVAL Attribute%)
  43.  
  44. Then, if you are running in the QuickBASIC environment, you should load
  45. the Quick Library with the command:
  46.  
  47.     QB yourprog.bas /L altquick.qlb
  48.  
  49. Thereafter you can call FastPrint, exactly as you would any other
  50. QuickBASIC SUB program, for example like this:
  51.  
  52.     FastPrint 25, 34, "Hello World!", 48
  53.  
  54. which will print 'Hello World!' in the middle of the 25th screen row
  55. displaying it in black characters on a cyan background (if you have a
  56. colour monitor). Notice that, since a DECLARE statement has been used, you
  57. don't need to place parentheses around the argument list and that even the
  58. CALL statement is unneccessary. Used in this way, Toolbox routines become
  59. actual extensions to the QuickBASIC language.
  60.  
  61. The same DECLARE statements can still be used when you compile your
  62. programs from the DOS command line. In this case, however, you must link
  63. the compiled program to ALTQUICK.LIB, the stand-alone library, with
  64. something like this:
  65.  
  66.     LINK yourprog,,,altquick.lib;
  67.  
  68. The QuickBASIC Linker will only extract, from ALTQUICK.LIB, those modules
  69. which are explicitly named by DECLARE statements in the source file. This
  70. ensures that your programs are not burdened with unneccessary code.
  71.  
  72. Toolbox routines do not require the BASIC runtime module to be present.
  73. You can use them to produce completely stand-alone application programs
  74. which can be distributed commercially.
  75.  
  76. As its name implies, the core routines in the Assembly-Language Toolbox
  77. are written in pure Intel 80x86 assembler. Because of this they are small,
  78. efficient and blindingly fast. Moreover, since any internal variables are
  79. stored in a routine's own code segment, your program does not have to
  80. share any of it's precious data space with the library.
  81.  
  82. Christy Gemmell                                                 June 1991
  83.  
  84. ──────────────────────────────────────────────────────────────────────────
  85.  
  86. The ShareWare version of the Assembly-Language Toolbox for QuickBASIC is
  87. provided, free of charge, to any QuickBASIC programmer who can find a use
  88. for it. You are encouraged to copy it, upload it to Electronic Bulletin
  89. Boards or pass it on to friends, provided only that you make no charge for
  90. doing so and that all the files on the disk are preserved intact. You may
  91. freely include Toolbox routines in your own programs, both for private use
  92. and for commercial distribution, without payment to the author.
  93.  
  94. The Professional version of the Toolbox, available to Registered Users,
  95. comes complete with all the source code, object modules for building your
  96. own custom libraries and many additional features. Hotline support is also
  97. included, at no extra charge.
  98.  
  99. ─────Registration and Support──────────────────────────────────────────────
  100.  
  101. U.K. and Europe:        £25.00 (including postage and packing)
  102.  
  103. Christy Gemmell         Singular Software
  104.                         22 Peake Road, Northfields,
  105.                         Leicester LE4 7DN
  106.                         United Kingdom
  107.                         
  108.                 Tel:    (044)-0533-767960
  109.  
  110. U.S.A. and Canada:      $47.50 (Including shipping)
  111.  
  112. James Kreyling          CPC Consulting Company
  113.                         1217 Crescent Dive
  114.                         Smithfield, Va. 23430
  115.                         U.S.A.
  116.  
  117.                 Tel:    (804)-357-9190 (Voice and FAX)
  118. or from Club-PC BBS:    (804)-357-0357 (8-N-1)
  119.  
  120. Note:   When ordering the Toolbox please specify if for QuickBASIC 4.5
  121.         or BASIC 7 PDS and the floppy disk format you require.
  122.  
  123. ─────About the author─────────────────────────────────────────────────────
  124.  
  125. Christy Gemmell, the author of this package, is also major author of the
  126. definitive textbook on QuickBASIC programming, the QuickBASIC BIBLE, which
  127. is published by Microsoft Press, in association with the Waite Group, at
  128. £24.95 ($27.95 US) ISBN 1-55615-262-0. Selected as Computer Book of the
  129. Month by Jerry Pournelle in the March 1991 issue of BYTE, its thousand
  130. pages are packed with information, tips and example programs which you
  131. wont find anywhere else.  Look out for it in your local bookstore.
  132.  
  133. The Assembly-Language Toolbox for QuickBASIC is used by thousands of
  134. programmers in Great Britain, Europe, the USA and Canada, Australasia and
  135. Japan, to build fast and powerful QuickBASIC programs. It has been shown
  136. at COMDEX and was featured in the November 1990 issue of BYTE magazine.
  137.  
  138. ───────────────────────────────────────────────────────────────────────
  139.  
  140.                 TOOLBOX FUNCTIONS AND PROCEDURES
  141.  
  142. This is a full, alphabetical, listing of the routines in the Assembly
  143. Language Toolbox which can be called directly by QuickBASIC programs>
  144.  
  145.  
  146. ATTRIB
  147.  
  148. This function returns the directory attributes of the specified file.
  149.  
  150. DECLARE FUNCTION Attrib% (FileSpec$)
  151.  
  152. FileSpec$ is the name of the file whose directory entry is to be tested.
  153. You should include the full pathname (including drive letter if necessary)
  154. if the file is not in the current directory.
  155.  
  156. The returned attribute value is bit-encoded as follows:
  157.  
  158.    Bit     Meaning (if set)
  159. ─────────────────────────────────────────────────────
  160.     0      Read-only     (file is Read/Write if zero)
  161.     1      Hidden
  162.     2      System
  163.     3      Volume label
  164.     4      Subdirectory
  165.     5      Archive
  166.     6      Not used
  167.     7      Shareable     (Novell Networks only)
  168. ─────────────────────────────────────────────────────
  169.  
  170. The ToolBox procedures; HIDE, SECURE and SHARE (see below) can be used to
  171. modify the attributes of a file.
  172.  
  173.  
  174. ATTRIBUTE
  175.  
  176. Converts standard MS-DOS foreground and background COLOR values into
  177. their equivalent display attribute number.
  178.  
  179. DECLARE FUNCTION Attribute% (BYVAL Fore%, BYVAL Back%)
  180.  
  181. Legal values:    Fore% = 0 - 31
  182.                  Back% = 0 - 15
  183.  
  184. The Assembly-Language Toolbox provides several routines which allow  your
  185. QuickBASIC programs to write text directly to the display with an
  186. attribute which you supply. For an explanation of display attributes, see
  187. the topic file COLOURS.HLP supplied with the Assembly-Language Toolbox
  188. demonstration program.
  189.  
  190. Note that the QuickBASIC COLOR statement only allows values of 0-7 for
  191. background colours. Toolbox display routines, however, accept the full
  192. range, using values of 8-15 to produce blinking or high-intensity
  193. background colours. See BLINKING (below) for a routine which allows
  194. you to select between these two modes.
  195.  
  196.  
  197. BACKFILL
  198.  
  199. This procedure changes the display attributes of the characters contained
  200. within the screen rectangle you specify, without overwriting the text
  201. itself.
  202.  
  203. DECLARE SUB BackFill (BYVAL R%, BYVAL C%, BYVAL H%, BYVAL W%, BYVAL A%)
  204.  
  205. R% = Top-left row of the rectangle to be coloured.
  206. C% = Top-left column of the rectangle.
  207. H% = Height of the rectangle in rows.
  208. W% = Width of the rectangle in columns.
  209. A% = Display attribute to use for colouring.
  210.  
  211.  
  212. BARMENU
  213.  
  214. Creates and operates a menu orientated horizontally on the screen row
  215. specified. The calling program must supply :
  216.  
  217. Row%        =   The screen row on which the menu bar will appear.
  218. Atr%        =   The display attribute or colour for the menu bar.
  219. Opt%        =   Number of options available for selection.
  220. Menu$()     =   String array containing selection list. Menu$(0) should
  221.                 be set to a string of ASCII characters, corresponding to
  222.                 the initial or key letter of each option in the list.
  223.                 Insert a space at the appropriate position of an option
  224.                 to be disabled. In the remaining option strings an
  225.                 ampersand '&' indicates that the next character is the
  226.                 Hotkey to be highlighted for that option.
  227. Bar%        =   The menu selection to be highlighted on entry into the
  228.                 procedure.
  229. Nxt%        =   If set, this flag just causes the menu to be refreshed
  230.                 without pausing for a selection from the user. This is
  231.                 used to handle presses on the Right or Left Arrow keys
  232.                 in the Pull-Down Menu procedure.
  233. Ctx%        =   If set, this flag indicates that context-sensitive help
  234.                 is available, in which case ...
  235. Tpc$        =   The root name of the Topic file to be displayed if the
  236.                 user presses <F1> for help. The current selection number
  237.                 is appended to this to produce the actual filename.
  238.  
  239.                 eg, if Tpc$ = "CONFIG" and Bar% = 3
  240.                 
  241.                 HelpMate (see TOOLBOX.DOC) will look for a Topic file
  242.                 named CONFIG3.HLP.
  243. Mouse%      =   If set, this flag indicates that a mouse is installed
  244.                 and can be used to make selections.
  245. HotKeys%    =   If set, this flag allows hotkeys to go directly to a
  246.                 selection without you having to press <ENTER> as well.
  247.  
  248. DECLARE SUB BarMenu (Row%, Atr%, Opt%, Menu$(), Bar%, Nxt%, Ctx%,_
  249.                      Topic$, Mouse%, HotKeys%)
  250.  
  251. On completion the procedure returns with the following variable set:
  252.  
  253. Bar%        =   Number of selection made by user. If zero then the
  254.                 <Escape> key was pressed to abort the procedure
  255.                 without making a selection.
  256.  
  257. VERMENU (see below) is a similar procedure which operates a vertically
  258. orientated point-and-shoot type menu.
  259.  
  260. See the source code of DEMON.BAS, the Toolbox demonstration program, for
  261. examples of BARMENU and VERMENU in use.
  262.  
  263.  
  264. BINDEC
  265.  
  266. Translates a string of binary digits to their long integer decimal
  267. equivalent.
  268.  
  269. DECLARE FUNCTION BinDec& (Binary$)
  270.  
  271.  
  272. BITSHL
  273.  
  274. Shifts all the bits of a long-integer number the specified number
  275. of places to the left.  This effectively multiplies the number by
  276. 2 ^ the number of places.
  277.  
  278. DECLARE SUB BitShl (Number&, Count%)
  279.  
  280. Number& =   The 32-bit number to be shifted 
  281.             (-2147483648 to 2147483647)
  282. Count%  =   The number of places to be shifted (1-31)
  283.  
  284.  
  285. BITSHR
  286.  
  287. Shifts all the bits of a long-integer number the specified number
  288. of places to the right.  This effectively divides the number by
  289. 2 ^ the number of places.
  290.  
  291. DECLARE SUB BitShr (Number&, Count%)
  292.  
  293. Number& =   The 32-bit number to be shifted 
  294.             (-2147483648 to 2147483647)
  295. Count%  =   The number of places to be shifted (1-31)
  296.  
  297.  
  298. BITRESET
  299.  
  300. Clears the specified bit (0-15) of the integer number supplied.
  301.  
  302. DECLARE SUB BitReSet (Number%, Bit%)
  303.  
  304.  
  305. BITSET
  306.  
  307. Sets the specified bit (0-15) in the integer number supplied to 1.
  308.  
  309. DECLARE SUB BitSet (Number%, Bit%)
  310.  
  311.  
  312. BITTEST
  313.  
  314. Returns logical TRUE (-1) if the bit (0-15) of Number% is set and FALSE
  315. (zero) if the bit is clear.
  316.  
  317. DECLARE FUNCTION BitTest% (Number%, Bit%)
  318.  
  319.  
  320. BLINKING
  321.  
  322. Toggles between blinking and high-intensity background colours
  323.  
  324. DECLARE SUB Blinking (BYVAL Switch%)
  325.  
  326. Switch% = 0         Turn background blink off/enable high intensity
  327.                     background colours.
  328.  
  329.         = non-zero  Enable background blinking/disable high intensity
  330.                     background colours
  331.  
  332. The QuickBASIC COLOR statement only recognises values of 0-7 for its'
  333. second parameter. Unlike the foreground, you cannot select blinking or
  334. high-intensity colours for the display backgound. The screen attribute
  335. parameter used with Toolbox routines such as FASTPRINT, however, do
  336. permit a background colour component in the range 0-15.
  337.  
  338. Normally, values between 8-15 will produce blinking backgrounds, but
  339. BLINKING allows you to turn the the blink off, forcing the background
  340. colour into high intensity mode. With blinking disabled you can use
  341. the full range of colours which are available to the foreground.
  342.  
  343. See ATTRIBUTE (above) for a function that calculates display attributes
  344. from the foreground and background colours you supply
  345.  
  346. Note:   This routine only works on systems with EGA, VGA and MCGA
  347.         display adaptors. Users of CGA adaptors, however, can get
  348.         the same effect by using the statement:  OUT &H3D8, 9
  349.  
  350. If you turn blinking off, remember to re-enable it before your program
  351. ends. Otherwise high-intensity backgrounds will remain in effect until
  352. another program resets the video card or you switch your computer off.
  353.         
  354.  
  355. CAPITAL
  356.  
  357. Converts all alphabetic characters in a string to lower-case,
  358. except for the first character of each word, which is forced
  359. to upper-case.
  360.  
  361. DECLARE FUNCTION CapItal$ (Original$)
  362.  
  363. This function is designed for use in printing address labels
  364. and can correctly identify and format proper surnames like
  365. 'McLaughlin'.
  366.  
  367.  
  368. CAPSLOCK
  369.  
  370. Toggles CAPS LOCK on or off or, alternatively, reads the current CAPS LOCK
  371. key setting.
  372.  
  373. DECLARE FUNCTION CapsLock% (BYVAL Switch%)
  374.  
  375. Switch% = 0  Turns CAPS LOCK off
  376.         = 1  Turns CAPS LOCK on
  377.  
  378. Any other value just returns the current CAPS status as a logical value
  379. where -1 (TRUE) means that CAPS LOCK is on and 0 (FALSE) means that CAPS
  380. LOCK is off.
  381.  
  382.  
  383. CGACOPY
  384.  
  385. Copies a CGA screen to or from a user-supplied string.
  386.  
  387. DECLARE SUB CgaCopy (BYVAL Switch%, Buffer$)
  388.  
  389. SWITCH%     Direction of copy   0 = copy screen to string
  390.                                 1 = copy string to screen
  391.  
  392. BUFFER$     String variable to hold the screen image, must be at least
  393.             16384 characters long or the call will fail. 
  394.  
  395. Note:       If you are using QuickBASIC 4 or 4.5, do not pass a fixed-
  396.             length string to this routine. Only variable-length strings
  397.             will work safely.
  398.  
  399. The QuickBASIC PCOPY statement is very useful for storing screen pages in
  400. memory, so that they can be kept out of sight until needed. Unfortunately
  401. it only works in text modes or, on computers with EGA or VGA video cards,
  402. in SCREEN modes 7 to 12. This routine, on the other hand, works only in
  403. the CGA display modes (SCREENs 1 and 2), it provides a useful alternative
  404. to the PCOPY statement for use with medium-resolution screens.
  405.  
  406. See also MCGACOPY for a version that can be used with SCREEN 13 displays.
  407.  
  408.  
  409. CGASCROLL
  410.  
  411. Scrolls a rectangular portion of a SCREEN 1 (320 x 200 4-colour) display
  412. four pixels to the left or to the right, wrapping the pixels which are 
  413. scrolled out at the end round to the beginning again.
  414.  
  415. DECLARE SUB CgaScroll (BYVAL xLoc%, BYVAL yLoc%, BYVAL xPixels%,_
  416.                        BYVAL yPixels%, BYVAL Direction%)                 
  417.  
  418. XLOC%       The horizontal (X) co-ordinate of the top-left corner of
  419.             the rectangle to be scrolled.
  420.  
  421. YLOC%       The vertical (Y) co-ordinate of the top-left corner of
  422.             the rectangle to be scrolled.
  423.  
  424. XPIXELS%    The width (in pixels) of the rectangle to be scrolled.
  425.  
  426. YPIXELS%    The height (in pixels) of the rectangle to be scrolled.
  427.  
  428. DIRECTION%  The direction in which the rectangle contents are to be
  429.             scrolled (0 = Left, 1 = Right).
  430.  
  431. Co-ordinates are in the ranges:  X >= 0 <= 319, Y >= 0 <= 199
  432.  
  433. X co-ordinates are aligned to the nearest byte (1 byte = 4 pixels).
  434.  
  435.  
  436. CGATEXT
  437.  
  438. Writes characters to the screen in the 320 x 200 4-colour graphics mode.
  439.  
  440. DECLARE SUB CgaText (BYVAL xLoc%, BYVAL yLoc%, Text$,_
  441.                      BYVAL Attr%, BYVAL Scale%)
  442.  
  443. This routine provides a convenient way of displaying text in SCREEN 1
  444. without having to bother about loading external font files. It uses the
  445. standard ROM-BIOS character definition tables built into your display
  446. adaptor, but allows you to scale them up to eight times normal size and to
  447. specify any combination of foreground and background colours.
  448.  
  449. XLOC%       The horizontal co-ordinate of the top left hand pixel
  450.             from which the text will begin (0 - 319)
  451.  
  452. YLOC%       The vertical co-ordinate of the top left hand pixel
  453.             from which the text will begin (0 - 199)
  454.  
  455. TEXT$       The string of text to be displayed (up to 63 characters).
  456.  
  457. ATTR%       The colour (or display attribute in monochrome modes) to
  458.             be given to the text. This is calculated by the formula:
  459.  
  460.             Colour% = (Background% * 256) + Foreground%
  461.  
  462.             Foreground and Background values are in the range 0 - 3
  463.  
  464. SCALE%      The character size of the text to be displayed. This ranges
  465.             from 1 to 8, where 1 is standard 40-column text and where 8
  466.             multiplies the character size by eight on both the horizontal
  467.             and vertical axes.
  468.  
  469. CGATEXT can handle both byte-aligned and non byte-aligned characters. The
  470. x, y co-ordinates you supply do not need to correspond to a row, column
  471. character cell in SCREEN 0, the alphanumeric mode. The complete ASCII set
  472. is supported, but to display foreign symbols and box-drawing characters on
  473. a CGA adaptor you must have the DOS GRAFTABL utility loaded.
  474.  
  475. Since CGATEXT does not support clipping, to ensure a clean display you
  476. must ensure that the text to be output fits within the current screen
  477. boundaries.
  478.  
  479. See also VGATEXT for displaying characters in SCREENs 7-12 and MCGATEXT
  480. for displaying characters in SCREEN 13.
  481.  
  482.  
  483. CENTRE
  484.  
  485. Centres the string supplied within an empty string of specified width.
  486.  
  487. DECLARE FUNCTION Centre$ (Text$, MaxWidth%)
  488.  
  489. This function is called by the VERMENU routine (see below) to centre the
  490. title of a pull-down menu within the window it refers to.
  491.  
  492.  
  493. CHECKPRINTER
  494.  
  495. This procedure checks if the specified parallel printer is ready and
  496. on-line. If so, it returns immediately with Ready% set to -1 (TRUE), if
  497. not, CHECKPRINTER displays the message 'PRINTER NOT READY' on the bottom
  498. row of the screen and waits for the operator to correct the problem and
  499. press a key.
  500.  
  501. If the user presses <Escape>, the procedure returns with Ready% set to
  502. zero (FALSE). Any other keystroke causes it to go back and test the
  503. printer again. CHECKPRINTER will not return until either the printer is
  504. ready for output, or the <Escape> key is pressed.
  505.  
  506. DECLARE SUB CheckPrinter (Printer%, Ready%)
  507.  
  508. Printer% is the number of the parallel printer to test (1 = LPT1: etc).
  509.  
  510. Example:    CheckPrinter 1, Ready%              ' Test LPT1:
  511.             IF NOT Ready% THEN
  512.                STOP
  513.             ELSE
  514.                LPRINT Stuff$
  515.             END IF 
  516.  
  517.  
  518. CIPHER
  519.  
  520. This routine requires that you supply two strings of characters. The first
  521. is the text to be encrypted, and the second is one or more keywords which
  522. are used to encipher the text. Thereafter, the text cannot be decrypted
  523. until you supply the same key string again.
  524.  
  525. DECLARE SUB Cipher (Text$, KeyWord$)
  526.  
  527. The encryption algorithm XORs (eXclusive ORs) the key string with string
  528. to be encrypted. This allows you to reverse the procedure and decrypt the
  529. text, simply by calling the routine a second time.
  530.  
  531. See the source code for DEMON.BAS, the ToolBox demonstration program, for
  532. an example using CIPHER.
  533.  
  534.  
  535. CLEAREND
  536.  
  537. Blank spaces of the display attribute specified are printed, starting at
  538. the current cursor position and continuing to the end of the line or,
  539. optionally, to the end of the screen.
  540.  
  541. DECLARE SUB ClearEnd (BYVAL Switch%, BYVAL Attr%)
  542.  
  543. Switch%   0 = clear to the end of the line.
  544.           1 = clear to the end of the screen.
  545.  
  546. Attr%     display attribute (1 - 255). If zero is specified then the
  547.           attribute of the character under the cursor is used.
  548.  
  549. Example:  ClearEnd 1, 0
  550.  
  551. Clears from the current cursor position to the bottom of the screen. The
  552. area cleared takes the background colour of the character under the
  553. cursor. The cursor, itself, is not updated.
  554.  
  555.  
  556. CPU
  557.  
  558. This function checks to see what type of microprocessor is installed in
  559. the computer in which the current program is running.
  560.  
  561. No calling parameters are required.
  562.  
  563. DECLARE FUNCTION Cpu% ()
  564.  
  565. The following processors can be identified by their return values :
  566.  
  567.  86 = Intel 8086          88 = Intel 8088         188 = Intel 80188        
  568. 186 = Intel 80186        286 = Intel 80286        386 = Intel 80386
  569. -86 = Intel 80C86        -88 = Intel 80C88         20 = NEC   V20
  570.  30 = NEC   V30
  571.  
  572. 486 = Intel 80486  included but not yet tested (lend us yours?).
  573.  
  574. This function is provided mainly for interest, although it can be used as
  575. an indication of how long a particular task will take to run. All of the
  576. Toolbox routines, in fact, are processor-independent and can be used on
  577. all types of IBM-PC, AT, PS/2 and compatible machines
  578.  
  579.  
  580. CURTAINS
  581.  
  582. This routine clears the display screen to the background colour specified
  583. by Attribute%. It differs from CLS in that the blanked-out area expands
  584. from a series of columns, giving the effect of a set of louvered blinds or
  585. curtains being closed. The Speed% parameter controls how quickly the
  586. routine runs, larger values making the curtains close more slowly.
  587.  
  588. DECLARE SUB Curtains (BYVAL Speed%, BYVAL Attribute%)
  589.  
  590. Try this example for a fancy effect:
  591.  
  592. FOR I% = 255 TO 0 STEP -16: Curtains 40, I%: NEXT
  593.  
  594. This procedure calls the DELAY routine (see below). This ensures that the
  595. speed value you specify will produce the same result on computers with any
  596. type of processor or clock speed.
  597.  
  598.  
  599. DATEINPUT
  600.  
  601. Accepts and verifies date input in a Reverse Video entry panel, all the
  602. usual editing keys are supported and entry is terminated by either a
  603. Carriage Return or one of several special function keys (see below).
  604.  
  605. DECLARE FUNCTION DateInput$ (Default$, Context%, Topic$, HotKey%)
  606.  
  607. Default$    =  default string which can be accepted by just pressing
  608.                the <Enter> key.
  609. Context%    =  set TRUE if context-sensitive help is available, in
  610.                which case ... 
  611. Topic$      =  name of the HELP Topic file to display whenever the
  612.                <F1> key is pressed. 
  613. HotKey%     =  If entry is terminated by anything other than the
  614.                <Enter> key, this variable will contain an explanatory
  615.                return code ..
  616.  
  617. Return Codes:   1  =  <Escape> abort entry returning a null string
  618.                 2  =  <F2>     repeat previous entry for this field
  619.                 3  =  <Up Arr> pressed, move to previous field 
  620.                 4  =  <Dn Arr> pressed, move to next field
  621.                 5  =  <Pg Up>  pressed, move to top of screen
  622.                 6  =  <Pg Dn>  pressed, move to end of screen
  623.  
  624. Editing Keys:   <L.Arrow>   =  Move cursor one character to the left
  625.                 <R.Arrow>   =  Move cursor one character to the right
  626.                 <Home>      =  Move cursor to first character of field
  627.                 <End>       =  Move cursor to last character of field
  628.                 <Ctrl End>  =  Clear from current cursor position to
  629.                                the end of the entry field.
  630.                 <BackSpace> =  Replace character under cursor with a
  631.                                blank space and move cursor one character
  632.                                to the left.
  633.                 <F1>        =  pop up on-line HELP screen.
  634.  
  635. DATEINPUT is designed to be used as part of a full-screen data-entry
  636. system. Your program can examine the return code to determine whether
  637. the operator wishes to terminate entry or move forwards or backwards
  638. between entry fields.
  639.  
  640. See also the REVINPUT function for a similar, more general-purpose,
  641. data-entry routine.
  642.  
  643.  
  644. DAYNUMBER
  645.  
  646. Convert a date in the form DD/MM/YYYY to a long integer. The values
  647. returned are valid with dates in the range 1/3/1900 - 31/12/2099.
  648.  
  649. DECLARE FUNCTION DayNumber& (BYVAL Day%, BYVAL Month%, BYVAL Year%)
  650.  
  651. See the INTERVAL function (below) for a method of calculating the number
  652. of days between two Julian dates.
  653.  
  654.  
  655. DAYSBETWEEN
  656.  
  657. Calculates the number of days between two dates, supplied as strings in
  658. the format DD/MM/YYYY. The function will provide accurate results when
  659. supplied with dates between 01/01/1901 and 31/12/2099.
  660.  
  661. DECLARE FUNCTION DaysBetween& (Date1$, Date2$)
  662.  
  663. See the INTERVAL function for a method of calculating the number of
  664. days between two Julian dates.
  665.  
  666.  
  667. DECBIN
  668.  
  669. Translates a decimal number to an equivalent string of binary digits.
  670.  
  671. DECLARE FUNCTION DecBin$ (Decimal&)
  672.  
  673.  
  674. DELAY
  675.  
  676. This procedure is like the QuickBASIC SLEEP statement, except that it
  677. allows you to specify an interval in milliseconds instead of just whole
  678. seconds. The delay will be exactly the same on a 4.77 MHz original PC as
  679. it would be on the latest 33-MHz 80486 machine.
  680.  
  681. DECLARE SUB Delay (BYVAL MilliSeconds%)
  682.  
  683. See the PAUSE routine (below) for a similar procedure which allows you to
  684. specify a delay in PC clock ticks.
  685.  
  686.  
  687. DISABLEPRTSC
  688.  
  689. This routine simply sets the Print Screen Busy flag at low-memory address
  690. 0040:0100 (Hex) so that any requests for the screen to be printed are
  691. ignored. Use this to prevent a careless operator from hanging-up the
  692. program by pressing <Prt Scrn> when the printer is off-line.
  693.  
  694. No calling parameters are required.
  695.  
  696. DECLARE SUB DisablePrtSc ()
  697.  
  698. Don't forget to use ENABLEPRTSC (see below) to re-enable this key
  699. otherwise it will remain disabled even after your program ends.
  700.  
  701.  
  702. DISKREADY
  703.  
  704. Tests if there is readable media in the floppy diskette drive specified. 
  705.  
  706. DRIVE% is the number of the diskette drive to be tested and is either
  707. zero (drive A:) or 1 (drive B:).
  708.  
  709. DECLARE FUNCTION DiskReady% (BYVAL Drive%)
  710.  
  711. This function returns a non-zero value if a readable diskette is in the
  712. drive, and zero (logical FALSE) if unable to read from the drive.
  713.  
  714. If the floppy disk in the drive specified is ready then the number that
  715. is returned is the Media Descriptor Byte, a value which indicates the
  716. type of diskette mounted, where:
  717.  
  718.       240   F0h  =  3.5"  2-sided, 18 sector
  719.       249   F9h  =  3.5"  2-sided, 9 sector or
  720.                     5.25" 2-sided, 15 sector
  721.       252   FCh  =  5.25" 1-sided, 9 sector
  722.       253   FDh  =  5.25" 2-sided, 9 sector
  723.       254   FEh  =  5.25" 1-sided, 8 sector
  724.       255   FFh  =  5.25" 2-sided, 8 sector             
  725.  
  726. DISKREADY only tests if the drive can be read from. It will not detect
  727. if the diskette in the drive is write-protected.
  728.  
  729.  
  730. DISPLAYMODE
  731.  
  732. Reads the current video display mode using the IBM ROM-BIOS numbering
  733. system.
  734.  
  735. DECLARE FUNCTION DisplayMode% ()
  736.  
  737. No calling parameters are required. Depending on the type of display
  738. adaptor installed, the function may return one of the following values:
  739.  
  740. Mode    Resolution      Mode     Colours    Remarks
  741. ─────────────────────────────────────────────────────────────────────
  742.   0     40 x 25         text        16      No colour burst
  743.   1     40 x 25         text        16      
  744.   2     80 x 25         text        16      No colour burst
  745.   3     80 x 25         text        16
  746.   4     320 x 200       graphics     4
  747.   5     320 x 200       graphics     4      No colour burst
  748.   6     640 x 200       graphics     2
  749.   7     80 x 25         text         2      Monochrome display only  
  750.   8     160 x 200       graphics    16      PCjr & Tandy 1000 only  
  751.   9     320 x 200       graphics    16      PCjr & Tandy 1000 only
  752.  10     640 x 200       graphics     4      PCjr & Tandy 1000 only
  753.  13     320 x 200       graphics    16      EGA & VGA
  754.  14     640 x 200       graphics    16      EGA & VGA
  755.  15     640 x 350       graphics     2      Monochrome EGA & VGA
  756.  16     640 x 350       graphics    16      EGA & VGA
  757.  17     640 x 480       graphics     2      VGA only
  758.  18     640 x 480       graphics    16      VGA only
  759.  19     320 x 200       graphics   256      VGA & MCGA      
  760. ─────────────────────────────────────────────────────────────────────
  761.  
  762. The SCREENMODE function (see below) can be used to return the equivalent
  763. QuickBASIC SCREEN number.
  764.  
  765.  
  766. DISPLAYPAGE
  767.  
  768. All video cards except the Monochrome Display Adaptor (MDA) are capable of
  769. switching between two or more pages of display memory. This function
  770. returns the number of the active video page, use the QuickBASIC SCREEN
  771. statement to select the page you require.
  772.  
  773. No calling parameters are required.
  774.  
  775. DECLARE FUNCTION DisplayPage% ()
  776.  
  777. The page number returned can be a value between 0 and 7, depending upon
  778. the current video mode and the amount of display memory installed.
  779.  
  780. Note:       all Toolbox routines which write directly to the screen will
  781.             automatically detect and send their output to the currently
  782.             active display page.
  783.  
  784.  
  785. DOSBOX
  786.  
  787. Restricts output directed to the console device to within the limits of
  788. the rectangular screen area you specify. Also allows you to specify the
  789. colour or display attribute of such output. When used in conjunction
  790. with the QuickBASIC SHELL command, this effectively lets you run DOS
  791. commands and programs in a window.
  792.  
  793. DECLARE SUB DOSBox (BYVAL Switch%, BYVAL Y1%, BYVAL X1%, BYVAL Y2%,_
  794.                     BYVAL X2%, BYVAL Attr%)
  795.  
  796. Arguments:  Switch%     1 = turn on output redirection  
  797.                         0 = turn off output redirection
  798.  
  799.             Y1%         Top-left row of screen rectangle
  800.  
  801.             X1%         Top-left column of screen rectangle
  802.             
  803.             Y2%         Bottom-right row of screen rectangle
  804.             
  805.             X2%         Bottom-right column of screen rectangle
  806.             
  807.             Attr%       Display attribute given to output.
  808.             
  809. This routine takes over the DOS internal 'FAST PUTCHAR' routine at
  810. Interrupt INT 29H which is called whenever DOS writes a character to
  811. the standard output device (the screen). You must remember to turn
  812. off any redirection, before your program ends, or the computer which
  813. it is running on will crash.
  814.  
  815. DOSBOX will only work properly with SHELLed programs which send screen
  816. output to standard output. All DOS internal and external commands do
  817. this as standard. Programs which write direct to video memory, however,
  818. and those which switch the display to graphics mode will behave
  819. unpredictablly when run from a DOSBOX SHELL.
  820.  
  821. For an example of how to use DOSBOX in action, see the source code for
  822. the SHELL to DOS option in the Exit menu of DEMON.BAS, the Toolbox
  823. demonstration program.
  824.  
  825.  
  826. DOSVERSION
  827.  
  828. Gets the current Operating System (DOS) version. The version is returned
  829. as a string in the form "3.20" (for DOS 3.2).
  830.  
  831. No calling parameters are required.
  832.  
  833. DECLARE FUNCTION DosVersion$ ()
  834.  
  835. The correct version will be returned, even under DOS 5.0 with SETVER
  836. set to report otherwise.
  837.  
  838.  
  839. DWPRINT
  840.  
  841. Sends the text supplied, to the printer, as a string of double-width
  842. characters. Output begins at the current print position and can,
  843. optionally, append a carriage-return/linefeed to take the print head to
  844. the beginning of a new line when finished.
  845.  
  846. DECLARE SUB DwPrint (BYVAL Printer%, Buffer$, BYVAL NewLine%)
  847.  
  848. Arguments:  Printer%    the parallel port output is to be sent to
  849.                         (1 = LPT1:, 2 = LPT2:, etc.).
  850.             Buffer$     the string of text to be printed.
  851.             NewLine%    set this to a non-zero value if you want 
  852.                         to move to a new line after printing.
  853.  
  854. The routine restores the previous print style or font before it returns
  855. and does not effect subsequent output to the printer, using the QuickBASIC
  856. LPRINT or PRINT # statements.
  857.  
  858. Note:       The version of this routine stored in the Toolbox
  859.             library is for EPSON compatible printers. If you have
  860.             an IBM graphics printer or ProPrinter, then you should
  861.             rebuild your libraries, using either the PRINTIBM.OBJ
  862.             or PRINTPRO.OBJ object module in place of PRINTEPS.OBJ.
  863.  
  864.  
  865. EMPRINT
  866.  
  867. Sends the text supplied, to the printer, as a string of emphasised
  868. characters. Output begins at the current print position and can,
  869. optionally, append a carriage-return/linefeed to take the print head to
  870. the beginning of a new line when finished.
  871.  
  872. DECLARE SUB EmPrint (BYVAL Printer%, Buffer$, BYVAL NewLine%)
  873.  
  874. Arguments:  Printer%    the parallel port output is to be sent to
  875.                         (1 = LPT1:, 2 = LPT2:, etc.).
  876.             Buffer$     the string of text to be printed.
  877.             NewLine%    set this to a non-zero value if you want 
  878.                         to move to a new line after printing.
  879.  
  880. The routine restores the previous print style or font before it returns
  881. and does not effect subsequent output to the printer, using the QuickBASIC
  882. LPRINT or PRINT # statements.
  883.  
  884. Note:       The version of this routine stored in the Toolbox
  885.             library is for EPSON compatible printers. If you have
  886.             an IBM graphics printer or ProPrinter, then you should
  887.             rebuild your libraries, using either the PRINTIBM.OBJ
  888.             or PRINTPRO.OBJ object module in place of PRINTEPS.OBJ.
  889.  
  890.  
  891. EMSERROR
  892.  
  893. Returns the code number of the last error which occurred during a
  894. call to the Expanded Memory Manager. If zero is returned, then no
  895. errors have occurred.
  896.  
  897. No calling parameters are required.
  898.  
  899. DECLARE FUNCTION EmsError% ()
  900.  
  901. Here is a list of possible error codes and their meanings:
  902.  
  903. 128  Internal error in EMM software     146  Source and target overlap
  904. 129  Malfunction in EMS hardware        147  Illegal region length
  905. 130  Memory manager busy                148  Region overlap
  906. 131  Invalid handle                     149  Offset outside logical page
  907. 132  Function not defined               150  Region length > 1MB
  908. 133  No more handles available          151  Cannot exchange overlap
  909. 134  Error in mapping context           152  Memory types undefined
  910. 135  Not enough pages exist             153  Not used
  911. 136  Not enough pages available         154  ARS not supported
  912. 137  Cannot allocate zero pages         155  ARS currently allocated
  913. 138  Page not allocated to handle       156  ARS not zero
  914. 139  Illegal physical page number       157  ARS not allocated
  915. 140  Save state area full               158  DMA channels not supported
  916. 141  Save of mapping context failed     159  Illegal DMA channel
  917. 142  Restore of mapping context failed  160  No handle for this name
  918. 143  Subfunction parameter not defined  161  Name already exists
  919. 144  Attribute type not defined         162  Memory address wrap
  920. 145  Feature not supported              163  Invalid pointer
  921.  
  922. 250  EMM not installed*                 251  LIM 4.0 required*
  923.  
  924. *    Toolbox error codes.
  925.  
  926. The descriptions are, of necessity, abbreviated. For more information 
  927. consult your EMS hardware manual or see:
  928.  
  929. Advanced MS-DOS Programming     by David Duncan     Microsoft Press
  930.  
  931.  
  932. EMSFRAME
  933.  
  934. Returns the segment address of the EMS page frame.
  935.  
  936. No calling parameters are required.
  937.  
  938. DECLARE FUNCTION EmsFrame% ()
  939.  
  940. The Page Frame is the area of conventional memory into which logical
  941. expanded memory pages are mapped. Under LIM 3.2 it is a contiguous
  942. block of 64RAM, divided into four 16K physical pages, located some-
  943. where between segments A000 and F000 Hex, but LIM 4.0 allows you to
  944. reserve additional 16K pages, wherever available memory exists. In
  945. either system you can rely on 4 consecutive 16K pages and this
  946. function returns a pointer to the first of them.
  947.  
  948.  
  949. EMSGET
  950.  
  951. Copies up to 64KB of data from expanded memory, starting at the
  952. logical page supplied, to an address in conventional memory.
  953.  
  954. DECLARE SUB EmsGet (BYVAL Segment%, BYVAL Offset%, BYVAL Length%,_
  955.                     BYVAL Page%, BYVAL Handle%, Done%)
  956.  
  957. Arguments:  Segment%  = segment address of target block to which
  958.                         data should be copied.
  959.             Offset%   = offset address, within target segment, to
  960.                         which data should be copied.
  961.             Length%   = length, in bytes (up to 64KB), of data to
  962.                         be copied. 
  963.             Page%     = logical EMS page holding the beginning of
  964.                         the data. If the block of data is bigger
  965.                         than 16KB, then copying will continue from
  966.                         subsequent pages until all the data has 
  967.                         been moved.
  968.             Handle%   = the EMS handle to which the page(s) have
  969.                         been allocated. This should be obtained by
  970.                         a previous call to the EMSRESERVE procedure
  971.                         (see below).
  972.             Done%     = a flag to hold the result of the operation.
  973.                         If the data was copied successfully, it is
  974.                         set to -1 (logical TRUE) on return. If zero
  975.                         (logical FALSE) is returned, the data was
  976.                         not copied successfully. In this case, you
  977.                         should make a call to the EMSERROR function
  978.                         to find out why.
  979.  
  980. If the target structure, to which the data is to be copied, is an
  981. array, you should specify its address by supplying the VARSEG and
  982. VARPTR of the first element. Be sure, however, that you do not copy
  983. a block of data bigger than the array size, otherwise you may 
  984. overwrite other variables, probably with disastrous results. 
  985.  
  986. See the EMSPUT procedure (below) for a means of copying data into
  987. logical expanded memory pages.
  988.  
  989.  
  990. EMSMAP
  991.  
  992. Map a logical expanded memory page to a physical page in the EMS
  993. Page Frame, making it accessible to your program.
  994.  
  995. DECLARE SUB EmsMap (BYVAL Handle%, Physical%, Logical%)
  996.  
  997. Arguments:  Handle%   = the EMS handle to which the logical page has
  998.                         been allocated. This will have been obtained
  999.                         by a previous call to the EMSRESERVE routine
  1000.                         (see below).
  1001.             Physical% = the number of the physical page to map
  1002.                         (in the range 1 to 4).
  1003.             Logical%  = the number of the logical page to be mapped
  1004.                         (in the range from 1 to the number of pages
  1005.                         allocated to Handle%).
  1006.  
  1007. For most applications, the EMSGET and EMSPUT procedures will be more
  1008. useful, since they perform all the necessary mapping for you while
  1009. moving data to and from expanded memory. If, however, you need to
  1010. manipulate small quantities of data in expanded memory, use this
  1011. routine to switch the relevant page into conventional memory, and
  1012. the FARPEEK and FARPOKE utilities (see below) to examine or change
  1013. the data itself.
  1014.  
  1015.  
  1016. EMSOWNED
  1017.  
  1018. Returns the number of logical pages of EMS memory that have been
  1019. allocated to the handle specified.
  1020.  
  1021. DECLARE FUNCTION EmsOwned% (BYVAL Handle%)
  1022.  
  1023.  
  1024. EMSPAGES
  1025.  
  1026. Returns either the total number of EMS pages in the system, or the
  1027. total number of free (unallocated) pages.
  1028.  
  1029. DECLARE FUNCTION EmsPages% (BYVAL Switch%)
  1030.  
  1031. Argument:   Switch% = 1  return number of unallocated pages.
  1032.                       0  return total number of pages in system.
  1033.  
  1034.  
  1035. EMSPRESENT
  1036.  
  1037. Tests whether the Expanded Memory System driver has been installed
  1038.  
  1039. No calling parameters are required.
  1040.  
  1041. DECLARE FUNCTION EmsPresent% ()
  1042.  
  1043. Returns:    -1  (logical TRUE) if EMS driver is installed.
  1044.              0  (logical FALSE) if EMS driver is not installed.
  1045.  
  1046. Note:       This function just checks that the EMS driver is in
  1047.             memory and that the EMS interrupt vector is directed
  1048.             to it, it does not test if the driver is active. Use
  1049.             the EMSVERSION function (see below) to test this. If
  1050.             the driver responds to that function, it can be safely
  1051.             assumed to be active.
  1052.  
  1053.  
  1054. EMSPUT
  1055.  
  1056. Copies up to 64KB of data to expanded memory, starting at the
  1057. logical page supplied, from an address in conventional memory.
  1058.  
  1059. DECLARE SUB EmsPut (BYVAL Segment%, BYVAL Offset%, BYVAL Length%,_
  1060.                     BYVAL Page%, BYVAL Handle%, Done%)
  1061.  
  1062. Arguments:  Segment%  = segment address of source block from which
  1063.                         data is to be copied.
  1064.             Offset%   = offset address, within target segment, from
  1065.                         which data is to be be copied.
  1066.             Length%   = length, in bytes (up to 64KB), of data to
  1067.                         be copied to expanded memory. 
  1068.             Page%     = logical EMS page to hold the beginning of
  1069.                         the data. If the block of data is bigger
  1070.                         than 16KB, then copying will continue onto
  1071.                         subsequent pages until all the data has 
  1072.                         been moved.
  1073.             Handle%   = the EMS handle to which the page(s) have
  1074.                         been allocated. This should be obtained by
  1075.                         a previous call to the EMSRESERVE procedure
  1076.                         (see below).
  1077.             Done%     = a flag to hold the result of the operation.
  1078.                         If the data is copied successfully, it will
  1079.                         be set to -1 (logical TRUE) on return. If
  1080.                         zero (logical FALSE) is returned, the data
  1081.                         was not copied successfully. In this case,
  1082.                         you should make a call to the EMSERROR
  1083.                         function to find out why.
  1084.  
  1085. If the source structure, from which the data is to be copied, is an
  1086. array, you should specify its address by supplying the VARSEG and
  1087. VARPTR of the first element. You can also copy data from absolute
  1088. addresses in memory to EMS, to copy the contents of the text screen,
  1089. for example, to EMS logical page 2, use the command:
  1090.  
  1091.     EmsPut &HB800, 0, 4000, 3, Handle%, Done%
  1092.  
  1093. This assumes that your computer has a colour monitor. If you have a
  1094. monochrome display, substitute &HB000 for the segment address.
  1095.  
  1096. See the EMSGET procedure (above) for a means of retrieving data from
  1097. extended memory.
  1098.  
  1099.  
  1100. EMSRELEASE
  1101.  
  1102. Free-up all the pages previously allocated to this handle, and make
  1103. them available to other processes.
  1104.  
  1105. DECLARE SUB EmsRelease (BYVAL Handle%)
  1106.  
  1107. You should release all the EMS pages which have been allocated to
  1108. handles owned by your program, before the program terminates. If
  1109. this is not done, these pages will not be available to subsequent
  1110. programs which may start up and will remain locked until the system
  1111. is rebooted.
  1112.  
  1113.  
  1114. EMSREQUEST
  1115.  
  1116. Asks for one or more logical pages of expanded memory to be made
  1117. available to your program.
  1118.  
  1119. DECLARE SUB EmsRequest (BYVAL Pages%, Handle%)
  1120.  
  1121. Arguments:  Pages%  = number of EMS pages to reserve.
  1122.  
  1123.             Handle% = if successful, this variable will hold the
  1124.                       number of the EMS handle which controls the
  1125.                       allocated pages. If unsuccessful, Handle%
  1126.                       will be set to zero on return, in which case
  1127.                       you should call the EMSERROR function (above)
  1128.                       to see what went wrong.
  1129.  
  1130. You must use this handle in all subsequent calls to the Expanded
  1131. Memory Manager which refer to these particular pages.
  1132.  
  1133. Before calling this procedure, it is a good idea to make a call to
  1134. the EMSPAGES function (see above) to see how many pages are free.
  1135.  
  1136.  
  1137. EMSRESIZE
  1138.  
  1139. Changes the number of pages allocated to an EMS handle.
  1140.  
  1141. DECLARE SUB EmsReSize (BYVAL Handle%, Pages%)
  1142.  
  1143. Arguments:  Handle% = a valid EMS handle to which logical expanded
  1144.                       memory pages have already been allocated.
  1145.  
  1146.             Pages%  = the new number of pages to be allocated to
  1147.                       this handle.
  1148.  
  1149. On return, Pages% will hold the actual number of pages that are
  1150. now allocated to the handle. If this is different from the number
  1151. of pages requested, then an error has occurred and you should call
  1152. the EMSERROR function (see above) to check what happened.
  1153.  
  1154. You can request a number of pages less than or greater than the
  1155. number previously allocated to the handle.
  1156.  
  1157. Note:       This facility is only available with LIM 4.0 EMS and
  1158.             above.
  1159.  
  1160.  
  1161. EMSVERSION
  1162.  
  1163. Returns the LIM version number of the Expanded Memory Manager.
  1164.  
  1165. No calling parameters are required.
  1166.  
  1167. DECLARE FUNCTION EmsVersion% ()
  1168.  
  1169. The number returned is a decimal integer where 32 represents LIM 3.2
  1170. and 40 represents LIM 4.0. If zero is returned, then an error has
  1171. occurred and you should call the EMSERROR function (see above) to
  1172. find out what happened. Use the EMSPRESENT function (also above) to
  1173. test that the EMM driver has, in fact, been installed.
  1174.  
  1175.  
  1176. ENABLEPRTSC
  1177.  
  1178. This routine clears the Busy flag at low-memory address 0040:0100 (Hex) so
  1179. that print-screen requests can be executed. Use it to cancel the effect of
  1180. the DISABLEPRTSC procedure (above).
  1181.  
  1182. No calling parameters are required.
  1183.  
  1184. DECLARE SUB EnablePrtSc ()
  1185.  
  1186.  
  1187. ENPRINT
  1188.  
  1189. Sends the text supplied, to the printer, as a string of enhanced
  1190. characters. Output begins at the current print position and can,
  1191. optionally, append a carriage-return/linefeed to take the print head to
  1192. the beginning of a new line when finished.
  1193.  
  1194. DECLARE SUB EnPrint (BYVAL Printer%, Buffer$, BYVAL NewLine%)
  1195.  
  1196. Arguments:  Printer%    the parallel port output is to be sent to
  1197.                         (1 = LPT1:, 2 = LPT2:, etc.).
  1198.             Buffer$     the string of text to be printed.
  1199.             NewLine%    set this to a non-zero value if you want 
  1200.                         to move to a new line after printing.
  1201.  
  1202. The routine restores the previous print style or font before it returns
  1203. and does not effect subsequent output to the printer, using the QuickBASIC
  1204. LPRINT or PRINT # statements.
  1205.  
  1206. Note:       The version of this routine stored in the Toolbox
  1207.             library is for EPSON compatible printers. If you have
  1208.             an IBM graphics printer or ProPrinter, then you should
  1209.             rebuild your libraries, using either the PRINTIBM.OBJ
  1210.             or PRINTPRO.OBJ object module in place of PRINTEPS.OBJ.
  1211.  
  1212.  
  1213. EXPLODE
  1214.  
  1215. Clear a screen rectangle explosively. This as an alternative to the
  1216. SCROLL routine listed below.
  1217.  
  1218. DECLARE SUB Explode (BYVAL Y1%, BYVAL X1%, BYVAL Y2%, BYVAL X2%,_
  1219.                      BYVAL Attr%, BYVAL Speed%)
  1220.  
  1221. Arguments:  Y1%         =  Upper-left row of rectangle to be cleared
  1222.             X1%         =  Upper-left column of rectangle
  1223.             Y2%         =  Lower-right row of rectangle
  1224.             X2%         =  Lower-right column of rectangle
  1225.             Attr%       =  Display attribute or colour that rectangle
  1226.                            should be cleared to 
  1227.             Speed%      =  Speed (in milliseconds) of explosion.
  1228.  
  1229. The panel is cleared, starting at the centre point, and progressively
  1230. moving outwards until the defined borders are reached. This gives the
  1231. impression of the clear area exploding onto the screen.
  1232.  
  1233. This routine is called, internally, by the POPUP window function (see
  1234. below) whenever Zoom is specified.
  1235.  
  1236.  
  1237. FARPEEK
  1238.  
  1239. Reads a byte of data from anywhere in conventional memory.
  1240.  
  1241. DECLARE FUNCTION FarPeek% (BYVAL Segment&, BYVAL Offset&)
  1242.  
  1243. Arguments:  Segment&  = address of memory segment containing the byte
  1244.                         to be read.
  1245.             Offset&   = offset address, within the segment of the 
  1246.                         byte to be read.
  1247.  
  1248. Returns:    The contents of the byte specified as an integer value
  1249.             in the range 0 to 255.
  1250.  
  1251. Note:       parameters are passed as LONG integers to save you the
  1252.             hassle of having to convert argument values over 32767
  1253.             to negative signed integers. Do not use values greater
  1254.             than 65535, however, or the most significant word will
  1255.             be ignored and the address converted to Modulus 65536.
  1256.  
  1257. Using QuickBASIC's PEEK function to examine data which lies outside
  1258. of DGROUP is a pain. You also have to use DEF SEG to set the segment
  1259. required and then to reset it afterwards. This function allows you to
  1260. read bytes, directly, from anywhere in the 1 megabyte of addressable
  1261. RAM space your computer contains.
  1262.  
  1263. The FARPOKE procedure (below) complements FARPEEK by allowing you to
  1264. write a byte of data anywhere in the 1MB addressable PC workspace.
  1265.  
  1266. See also PEEKWORD and POKEWORD which allow you to read from and write
  1267. to memory, two bytes at a time.
  1268.  
  1269. Note:       If you have an Intel 286, 386 or 486-based computer with
  1270.             the Microsoft HIMEM.SYS driver loaded, you can even use
  1271.             FARPEEK to read from the first 64KB of Extended Memory.
  1272.             Setting the segment to &HFFFF and an offset in the range
  1273.             &H10 to &HFFFF allows you access up to 65520 bytes of
  1274.             memory ABOVE the normal 1MB limit.
  1275.  
  1276.  
  1277. FARPOKE
  1278.  
  1279. Writes a byte of data to anywhere in conventional memory.
  1280.  
  1281. DECLARE SUB FarPoke (BYVAL Segment&, BYVAL Offset&, BYVAL Byte%)
  1282.  
  1283. Arguments:  Segment&  = address of memory segment containing the byte
  1284.                         to be written to
  1285.             Offset&   = offset address, within the segment of the 
  1286.                         byte to be written.
  1287.             Byte%     = the value (0 to 255) to be written to the
  1288.                         specified byte.
  1289.  
  1290. Note:       addresses are passed as LONG integers to save you the
  1291.             hassle of having to convert argument values over 32767
  1292.             to negative signed integers. Do not use values greater
  1293.             than 65535, however, or the most significant word will
  1294.             be ignored and the address converted to Modulus 65536.
  1295.  
  1296. Using QuickBASIC's POKE function to write to memory which is outside
  1297. of DGROUP is a pain. You also have to use DEF SEG to set the segment
  1298. you want and then to set it back again afterwards. This function lets
  1299. you write bytes, directly, anywhere in the 1 megabyte of addressable
  1300. RAM space your computer contains.
  1301.  
  1302. The FARPEEK procedure (above) complements FARPOKE by allowing you to
  1303. read a byte of data from anywhere in the 1MB of addressable memory.
  1304.  
  1305. See also PEEKWORD and POKEWORD which allow you to read from and write
  1306. to memory, two bytes at a time.
  1307.  
  1308.  
  1309. FASTPRINT
  1310.  
  1311. This procedure can be used to display a string of text directly to video
  1312. memory. It is much  faster than the normal DOS services and does not
  1313. update the cursor.
  1314.  
  1315. DECLARE SUB FastPrint (BYVAL Row%, BYVAL Col%, Message$, BYVAL Attr%)
  1316.  
  1317. Row%        is the row where printing is to start.
  1318. Col%        is the column where printing is to start.
  1319. Message$    is the string of text to be printed.
  1320. Attr%       is the video attribute given to the text.
  1321.  
  1322. Row% and Col% follow the QuickBASIC convention of numbering screen rows
  1323. and columns with Row = 1, Column = 1 being at the top-left corner of the
  1324. display. The maximum value for Row% depends on the capabilities of the
  1325. video adaptor installed and is determined by the last WIDTH statement.
  1326. Normally it is 25 but may extend to 43 (EGA) or even 50 rows (VGA).
  1327. Maximum columns may be either 40 or 80 (the default).
  1328.  
  1329. If multiple screen pages are being used, FASTPRINT will correctly identify
  1330. the active one and output to the proper video address.
  1331.  
  1332. Note:       if an attribute of -1 is specified, the output string takes
  1333.             the colour or attribute already set into that portion of the
  1334.             screen where the string is printed.
  1335.             
  1336. Thanks to John Turnbull of Macclesfield for this suggestion.
  1337.             
  1338.  
  1339. FILEDATE
  1340.  
  1341. Gets or sets the date and time of the specified file as is displayed in
  1342. directory listings.
  1343.  
  1344. DECLARE SUB FileDate (BYVAL Switch%, DateTime$, FileSpec$)
  1345.  
  1346. Switch%     if set to a value of 1, changes the date and time of the file
  1347.             to the parameters specified in DateTime$. Any other value
  1348.             returns the date and time that the file was last written to
  1349.             in DateTime$
  1350.  
  1351. DateTime$   A string of at least 17 characters in length. If setting the
  1352.             date and time of a file, this must be written in a standard
  1353.             UK date/time format, ie:
  1354.  
  1355.             "DD/MM/YY HH:MM:SS"
  1356.  
  1357.             If you are reading the date and time, it is not necessary to
  1358.             pre-format the string, as the function will do it for you. The
  1359.             string must be of sufficient length to hold the returned date
  1360.             and time, however, or the procedure will fail.
  1361.  
  1362. FileSpec$   A string holding the pathname of the file to be examined or
  1363.             changed. It can include the drive letter and directory path
  1364.             were appropriate, but must be an explicit pathname. Wildcard
  1365.             characters are not allowed. Maximum length is 64 characters.
  1366.  
  1367. The procedure will fail if the file does not exist or is not on the path
  1368. specified. Also, since the file is actually opened by the procedure, there
  1369. must be at least one free DOS file handle available when you call it.
  1370.  
  1371. You cannot change the date and time of a file which has been flagged as
  1372. readonly or, on a network, is owned by another program.
  1373.  
  1374.  
  1375. FILESIZE
  1376.  
  1377. This function will return the size of the file specified in bytes, or, if
  1378. more than one match is found, the total size of all such files. If a size
  1379. of zero is returned, no matching file exists (at least not in the
  1380. directory specified).
  1381.  
  1382. DECLARE FUNCTION FileSize& (FileSpec$)
  1383.  
  1384. The filename can include a directory path and may be ambiguous, using the
  1385. wildcard characters '*' and '?'.
  1386.  
  1387. Note:   In previous versions of the Toolbox this function was called
  1388.         SIZEOF. In MASM 6, however, SIZEOF is now a reserved word so the
  1389.         name has had to be changed.
  1390.  
  1391.  
  1392. FINDFILE
  1393.  
  1394. This function can be used to locate a particular file in any drive or
  1395. directory of the current system. Supply it with a pathname or an ambiguous
  1396. filespec and it will display a list of all matching files from which the
  1397. user can select the one required by highlighting it with the cursor arrow
  1398. keys. The function returns the full pathname of the file selected or a
  1399. null string if <ESC> was pressed.
  1400.  
  1401. DECLARE FUNCTION FindFile$ (FileSpec$, Attr%, Mouse%)
  1402.  
  1403. FileSpec$   =  Pathname of file to be located. It can include a drive
  1404.                letter and the filename may be ambiguous if you use the
  1405.                wildcard characters '*' or '?'.
  1406.  
  1407. Attr%       =  The display attribute for the file selection box if more
  1408.                than one match is expected. If Attr% = 0 the function
  1409.                uses default colours - Black on Cyan for colour monitors
  1410.                and inverse video for monochrome monitors.
  1411.  
  1412. Mouse%      =  set this to TRUE (non-zero) if mouse support is required.
  1413.  
  1414. On entry, FILESPEC$ should contain the name of the file to be located. If
  1415. the filespec is ambiguous, the program presents a directory listing, in a
  1416. popup window, of all files which match and allows the operator to select
  1417. the actual one required. If the pathname is explicit, FindFile just checks
  1418. if it actually exists. On return FILESPEC$, will contain the full pathname
  1419. of the selected file, or a null string if it was not located (or the
  1420. <Escape> key was pressed).
  1421.  
  1422.  
  1423. FLOPPYDRIVES
  1424.  
  1425. This function returns the number of installed diskette drives in the
  1426. current computer system.
  1427.  
  1428. DECLARE FUNCTION FloppyDrives% ()
  1429.  
  1430. No calling parameters are required.
  1431.  
  1432.  
  1433. FREESPACE
  1434.  
  1435. You must supply the drive number of the diskette or fixed-disk which you
  1436. want to test (1 = drive A:, 2 = drive B:, etc). Pass a value of zero to
  1437. test the currently-logged or default drive. The amount of free space is
  1438. returned in bytes.
  1439.  
  1440. DECLARE FUNCTION FreeSpace& (BYVAL DriveNo%)
  1441.  
  1442. Note:       The return value will not be reliable if the drive being
  1443.             tested has an extended DOS partition which contains more
  1444.             than 32MB of free space.
  1445.  
  1446.  
  1447. GAMESPORT
  1448.  
  1449. This function checks to see if the host computer is fitted with an adaptor
  1450. for joysticks or a games paddle.
  1451.  
  1452. No calling parameters are required.
  1453.  
  1454. DECLARE FUNCTION GamesPort% ()
  1455.  
  1456. Returns logical TRUE (-1) if a games adaptor is present or FALSE (0) if no
  1457. games adaptor is fitted.
  1458.  
  1459.  
  1460. GETFLAG
  1461.  
  1462. The MIXED-LANGUAGE Toolbox includes a pair of functions which give you
  1463. access to the INTRA-APPLICATION COMMUNICATION AREA (IAC), an area of
  1464. memory which has been reserved, by DOS, so that programs can communicate
  1465. with each other. The IAC is 16 bytes long and is located, in low RAM at
  1466. addresses 0000:04F0 - 04FF (Hex). Once set, an IAC flag retains it's value
  1467. until you reset it or the computer is rebooted.
  1468.  
  1469. This function returns the value of one of the IAC flag bytes (1 to 16).
  1470.  
  1471. DECLARE FUNCTION GetFlag% (Flag%)
  1472.  
  1473. You can set the current setting of a particular IAC flag byte with the
  1474. SETFLAG function.
  1475.  
  1476. Since QuickBASIC programs, compiled with the /O switch to run stand-alone,
  1477. cannot pass variables to chain modules, you can use this feature to
  1478. implement a limited form of parameter passing.
  1479.  
  1480.  
  1481. GRAPRINT
  1482.  
  1483. This routine simply serves as a function despatcher for the various
  1484. graphics text procedures, which can also be called directly. It is
  1485. intended to be called from programs which must run under a variety of
  1486. video adaptors, transferring control to the proper routine for the current
  1487. video mode. The calling program must supply appropriate parameters,
  1488. however.
  1489.  
  1490. DECLARE SUB GraPrint (BYVAL xLoc%, BYVAL yLoc%, Text$,_
  1491.                       BYVAL Attr%, BYVAL Scale%)
  1492.  
  1493. GRAPRINT provides a convenient way of displaying text in any of the EGA,
  1494. VGA and MCGA graphics modes (SCREENs 7-13) as well as the 320 x 200 pixel
  1495. 4-colour CGA mode (SCREEN 1) without having to bother about loading
  1496. external font files. It uses the standard character definition tables
  1497. built into your display adaptor, but allows you to scale them up to eight
  1498. times normal size and to specify any combination of foreground and
  1499. background colours supported by the current video mode.
  1500.  
  1501. XLOC%       The horizontal co-ordinate of the top left hand pixel
  1502.             from which the text will begin
  1503.  
  1504. YLOC%       The vertical co-ordinate of the top left hand pixel
  1505.             from which the text will begin
  1506.  
  1507. TEXT$       The string of text to be displayed (up to 63 characters).
  1508.  
  1509. ATTR%       The colour (or display attribute in monochrome modes) to
  1510.             be given to the text. This is calculated by the formula:
  1511.  
  1512.             Colour% = (Background% * 256) + Foreground%
  1513.  
  1514.             The GRATTRIB function (see below) will perform this
  1515.             calculation for you, automatically, using the foreground
  1516.             and background values you supply.
  1517.  
  1518.             Foreground and Background values are in the ranges used
  1519.             by the current video mode (eg. 0 - 15 for SCREEN 9). The
  1520.             actual colours displayed depend upon your current PALETTE
  1521.             settings.
  1522.  
  1523.             Note:   supplying a value of -1 for background prevents
  1524.                     background pixels from being changed at all. This
  1525.                     allows text to be blended more naturally into a
  1526.                     complex graphics display, it is not supported in
  1527.                     320 x 200 4-colour mode, however.
  1528.  
  1529. SCALE%      The character size of the text to be displayed. This ranges
  1530.             from 1 to 8, where 1 is standard 80-column text (40-column
  1531.             in SCREEN 7) and 8 multiplies the character size by eight
  1532.             on both the horizontal and vertical axes.
  1533.  
  1534. GRAPRINT can handle both byte-aligned and non byte-aligned characters. The
  1535. x, y co-ordinates you supply do not need to correspond to a row, column
  1536. character cell in SCREEN 0, the alphanumeric mode. The complete extended
  1537. ASCII character set is supported, including foreign symbols and box-
  1538. drawing characters (computers with CGA adaptors must have GRAFTBL loaded
  1539. to access characters above ASCII 127, however).
  1540.  
  1541. Since GRAPRINT does not support clipping, to ensure a clean display you
  1542. must ensure that the text to be output fits within the current screen
  1543. boundaries.
  1544.  
  1545. See also CGATEXT for displaying characters in SCREEN 1, MCGATEXT for
  1546. displaying characters in SCREEN 13 and VGATEXT for displaying text in
  1547. the EGA and VGA video modes (SCREENs 7-12).
  1548.  
  1549.  
  1550. GRATTRIB
  1551.  
  1552. Calculate display attribute for graphics modes, given the foreground
  1553. and background colours required.
  1554.  
  1555. DECLARE FUNCTION GrAttrib% (ForeGround%, BackGround%)
  1556.  
  1557. GRATTRIB calculates the attribute value which controls the foreground and
  1558. background colours of characters displayed using the GRAPRINT, CGATEXT,
  1559. MCGATEXT and VGATEXT procedures. It translates them using the formula:
  1560.  
  1561.     Attribute% = (BackGround% * 256) + ForeGround%
  1562.  
  1563. Make sure that you use foreground and background colour values appropriate
  1564. to the SCREEN mode currently in use.
  1565.  
  1566. The ATTRIBUTE function provides a similar service for use with text mode
  1567. screens
  1568.  
  1569.  
  1570. HANDLES
  1571.  
  1572. Returns the number of file handles available in the System File Table
  1573.  
  1574. DECLARE FUNCTION Handles% ()
  1575.  
  1576. The number returned by this function is equivalent to the value given
  1577. to the FILES = statement in your CONFIG.SYS script. Note that the first
  1578. five of these handles are reserved for DOS's internal use.
  1579.  
  1580.  
  1581. HELPMATE
  1582.  
  1583. This routine provides a context-sensitive on-line Help facility for your
  1584. QuickBASIC programs.
  1585.  
  1586. DECLARE SUB HelpMate (BYVAL Colour%, Title$, BYVAL Context%, Topic$)
  1587.  
  1588. Colour%   is the display attribute to be given to the Help window. If a
  1589.           value of zero is passed, HELPMATE uses default colours which
  1590.           are Black on Cyan for colour screens and inverse video for a
  1591.           monochrome display.
  1592.  
  1593. Title$    is an optional Title for the Help window. If one is supplied
  1594.           it must be no longer than 48 characters so that it can be
  1595.           easily centered in the top row of the window. If Title$ is a
  1596.           null string, HELPMATE uses its' own name as a default.  
  1597.  
  1598. Context%  is the context-sensitive flag. If set to 1, then the routine
  1599.           attempts to load the file specified by ...
  1600.  
  1601. Topic$    A legal DOS filename (up to 8 characters without extension),
  1602.           specifying the name of the Topic file to be displayed. 
  1603.           HelpMate automatically appends the extension '.HLP'.  
  1604.  
  1605. If Context% is not set, (or Topic$ is a null string), then the routine
  1606. displays a list of topics, from which you can make your own selection.
  1607.  
  1608. If Context% is set, HELPMATE will display the first page of the Topic file
  1609. specified, otherwise it begins by  overlaying the current screen with a
  1610. popup window in which is listed those HELP topics available.
  1611.  
  1612. The first topic in the list is highlighted and you can move the highlight
  1613. around the menu with the arrow keys Highlight the topic you want, then
  1614. press the <RETURN> key. The first page of that topic will be displayed in
  1615. the HELP window.
  1616.  
  1617. Page backwards and forwards through the file using the <PG UP> and <PG DN>
  1618. keys. If you page past the end of the file you will be returned to the
  1619. topic list, where you can either select another topic, or press <ESC> to
  1620. return to the QuickBASIC program. On return, the original screen and all
  1621. current variables are restored, intact, and program execution will
  1622. continue with the statement following the procedure call.
  1623.  
  1624. By default, the Toolbox Help system looks for its topic files in a sub-
  1625. directory called HELP, beneath the currently-logged directory. You can,
  1626. however, direct it to look elsewhere for files by setting a HELP variable
  1627. in the DOS environment table
  1628.  
  1629. e.g.  SET HELP=C:\BASIC\TOOLBOX\HELP
  1630.  
  1631. Alternatively, you can use the QuickBASIC ENVIRON statement within your
  1632. program, to point HELPMATE to the appropriate pathname. Remember, though,
  1633. that this method only remains in effect as long as the current program is
  1634. running and that there must be enough environment space available to hold
  1635. the HELP directory pathname.
  1636.  
  1637. A set of example Topic files, for use with the demonstration program,
  1638. DEMON.EXE is supplied with the Assembly-Language ToolBox. You can make
  1639. your own, using any Word Processor or Text Editor which can output plain
  1640. ASCII text (EDLIN will do). If you do so, bear in mind that the HelpMate
  1641. window's maximum page size is 16 rows of 55-column text. The maximum
  1642. number of pages in any one file is 256.
  1643.  
  1644.                              TIP
  1645.  
  1646. When displaying the list of available Topics, HelpMate searches the
  1647. current HELP directory for files with the extension .HLP. However, since
  1648. there is only room for 60 such filenames to be displayed in the menu
  1649. window, any files in excess of this number will be not be listed and are,
  1650. hence, inaccessible. You can, however, read any number of Context-
  1651. sensitive topic files since these are named explicitly in the call to
  1652. HelpMate which loads them. They need not, therefore, appear in the Topic
  1653. list.
  1654.  
  1655. If your application needs to provide a large number of Topic files, it is
  1656. a good idea to hide those which are context-sensitive from normal
  1657. directory searches (you can use the Toolbox Hide function to do this).
  1658. This will not prevent these files from being loaded when called, but it
  1659. does prevent them from appearing in the Topic list which gives you more
  1660. room for those general-purpose topic files which are selected by the user.
  1661.  
  1662. Note:       The \HELP directory on the ToolBox distribution disk
  1663.             contains a number of these hidden files for use by the
  1664.             demonstration program DEMON.EXE.
  1665.  
  1666.  
  1667. HIBYTE
  1668.  
  1669. Returns the value contained in the Most Significant Byte (MSB) of a
  1670. two-byte integer. This is effectively the same as dividing the
  1671. number by 256.
  1672.  
  1673. DECLARE FUNCTION HiByte% (BYVAL Number%)
  1674.  
  1675. See LOBYTE for a function which returns the Least Significant Byte
  1676. (LSB) of an integer.
  1677.  
  1678.  
  1679. HIDE
  1680.  
  1681. Toggles the Hidden bit of the specified file's directory entry, making it
  1682. visible or invisible to directory listings.
  1683.  
  1684. DECLARE SUB Hide (BYVAL Switch%, FileSpec$)
  1685.  
  1686. If SWITCH% = 1 the file is hidden (regardless of whether it is currently
  1687. visible or not), any other value makes the file visible. FileSpec$ is the
  1688. name of the file to be hidden or unhidden. It can include a drive letter
  1689. and directory path but must be an explicit pathname, wildcard characters
  1690. are not allowed.
  1691.  
  1692.  
  1693. HIWORD
  1694.  
  1695. Returns the value contained in the Most Signifant Word (MSW) of a
  1696. four-byte long integer. This is effectively the same as dividing the
  1697. number by 65536.
  1698.  
  1699. DECLARE FUNCTION HiWord% (BYVAL Number&)
  1700.  
  1701. See LOWORD for a function which returns the Least Significant Word
  1702. (LSW) of a long integer.
  1703.  
  1704.  
  1705. INFORM
  1706.  
  1707. Displays the message supplied in a dialogue box and waits for the user to
  1708. press the <ENTER> key before restoring the screen to its' previous state.
  1709.  
  1710. DECLARE SUB Inform (BYVAL Row%, Message$, BYVAL Attr%, BYVAL Mouse%)
  1711.  
  1712. ROW%        The top row of the dialogue box when it is displayed. The
  1713.             box is automatically centered within this row, which may be
  1714.             adjusted so that it remains within the screen boundaries.
  1715.  
  1716. MESSAGE$    A string of text comprising the message to be displayed. It
  1717.             must be no longer than 40 characters otherwise it will be
  1718.             truncated to fit inside the display panel.
  1719.  
  1720. ATTR%       The display attribute or colour to be given to the dialogue
  1721.             box. If an argument of zero is supplied, the box is displayed
  1722.             in cyan with a black foreground (colour monitors) or reverse
  1723.             video (monochrome monitors). On colour displays the message
  1724.             text always has a white foreground, no matter what attribute
  1725.             is specified.
  1726.  
  1727. MOUSE%      Should be set to TRUE (-1) or FALSE (0) to indicate if a
  1728.             mouse is available for use. If available, the operator can
  1729.             respond by clicking the left mouse button while the cursor is
  1730.             positioned on the radio button.     
  1731.  
  1732. This procedure is nearly identical to the MISTAKE routine (below) which is
  1733. designed for displaying error messages.
  1734.  
  1735.  
  1736. INT2E
  1737.  
  1738. Provides an interface to the MS-DOS kernel interrupt 2E (hex) service
  1739. which is sometimes called the 'Back Door to the Command Processor'.
  1740.  
  1741. DECLARE SUB Int2E (DosCmd$)
  1742.  
  1743. DosCmd$ can contain any legal MS-DOS command including the name of an
  1744. external program to be executed. 
  1745.  
  1746. INT2E is an alternative to the SHELL command already provided by
  1747. QuickBASIC. It has one advantage, however, in that many commands are
  1748. passed directly to the MS-DOS kernal instead of to a secondary copy
  1749. of the command processor. For example a SET command passed to INT2E
  1750. will set a string in the MS-DOS master environment instead of the
  1751. current program's local environment. Master environment variables
  1752. are preserved when the program terminates and are available to any
  1753. subsequent programs which may be started up.
  1754.  
  1755. If the command you pass is the name of an external command or if it
  1756. requires COMMAND.COM to be loaded then you must make sure that there
  1757. is enough memory available for it to be executed. You can free-up
  1758. memory by using QuickBASIC's SETMEM function with the appropriate
  1759. negative value.
  1760.  
  1761. Be aware that the INT 2Eh service is not documented or supported by
  1762. Microsoft and successful operation cannot be guaranteed. If the
  1763. procedure fails due to there being insufficient memory or for some 
  1764. other reason, no error message will be returned. For this reason,
  1765. the SHELL statement is usually to be preferred for accessing MS-DOS
  1766. functions, since this can be trapped for errors.
  1767.  
  1768. Note that INT2E will only work with genuine versions of Microsoft
  1769. MS-DOS or IBM PC-DOS. It will not work under DR-DOS, Norton NDOS or
  1770. versions of 4DOS prior to 4.0.
  1771.  
  1772.  
  1773. INTERVAL
  1774.  
  1775. Calculate the number of days between two dates supplied as long integer
  1776. Julian numbers. You can use the DAYNUMBER function (see above) to turn
  1777. dates in normal numeric format into Julian numbers and NUMBERDAY (below)
  1778. to convert them back again.
  1779.  
  1780. DECLARE FUNCTION Interval& (First&, Second&)
  1781.  
  1782. This function always returns a positive value, regardless of whether the
  1783. first argument is lower or greater than the second.
  1784.  
  1785.  
  1786. ISDIR
  1787.  
  1788. This routine tests to see if the supplied string is the name of a
  1789. directory. To do this a local error handler is established to trap any
  1790. run-time errors and an attempt is made to change to the directory
  1791. specified in TEST$. If an error occurs then ISDIR% is set to Boolean FALSE
  1792. (zero), otherwise TRUE (-1) is returned.
  1793.  
  1794. DECLARE FUNCTION IsDir% (Test$)
  1795.  
  1796. ISDIR is used by the FINDFILE function when searching for files on another
  1797. drive or directory.
  1798.  
  1799.  
  1800. ITPRINT
  1801.  
  1802. Sends the text supplied, to the printer, as a string of italic characters.
  1803. Output begins at the current print position and can, optionally, append a
  1804. carriage-return/linefeed to take the print head to the beginning of a new
  1805. line when finished.
  1806.  
  1807. DECLARE SUB ItPrint (BYVAL Printer%, Buffer$, BYVAL NewLine%)
  1808.  
  1809. Arguments:  Printer%    the parallel port output is to be sent to
  1810.                         (1 = LPT1:, 2 = LPT2:, etc.).
  1811.             Buffer$     the string of text to be printed.
  1812.             NewLine%    set this to a non-zero value if you want 
  1813.                         to move to a new line after printing.
  1814.  
  1815. The routine restores the previous print style or font before it returns
  1816. and does not effect subsequent output to the printer, using the QuickBASIC
  1817. LPRINT or PRINT # statements.
  1818.  
  1819. Note:       The version of this routine stored in the Toolbox
  1820.             library is for EPSON compatible printers. If you have
  1821.             an IBM graphics printer or ProPrinter, then you should
  1822.             rebuild your libraries, using either the PRINTIBM.OBJ
  1823.             or PRINTPRO.OBJ object module in place of PRINTEPS.OBJ.
  1824.  
  1825.  
  1826. KEYFLAGS
  1827.  
  1828. Returns a 16-bit unsigned number which is bit-encoded with the current
  1829. status of the CTRL, ALT, INSERT and other keyboard control keys.
  1830.  
  1831. No calling parameters are required.
  1832.  
  1833. DECLARE FUNCTION KeyFlags% ()
  1834.  
  1835. The BITTEST function (see below) can be used to isolate individual bits of
  1836. the returned value. Their meanings are as follows:
  1837.  
  1838.  F E D C B A 9 8 7 6 5 4 3 2 1 0   Bits
  1839. ┌─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐
  1840. │0│0│0│0│0│0│0│0│0│0│0│0│0│0│0│0│  Meaning if set
  1841. └─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┘
  1842.  │ │ │ │ │ │ │ │ │ │ │ │ │ │ └─┴─  Left & Right SHIFT keys pressed
  1843.  │ │ │ │ │ │ │ │ │ │ │ │ │ └─────  CTRL key pressed
  1844.  │ │ │ │ │ │ │ │ │ │ │ │ └───────  ALT key pressed
  1845.  │ │ │ │ │ │ │ │ │ │ │ └─────────  SCROLL LOCK active
  1846.  │ │ │ │ │ │ │ │ │ │ └───────────  NUM LOCK active
  1847.  │ │ │ │ │ │ │ │ │ └─────────────  CAPS LOCK active
  1848.  │ │ │ │ │ │ │ │ └───────────────  INSERT key status
  1849.  │ │ │ │ │ │ │ └─────────────────  Left CTRL key pressed
  1850.  │ │ │ │ │ │ └───────────────────  Left ALT key pressed
  1851.  │ │ │ │ │ └─────────────────────  SYS REQ key pressed
  1852.  │ │ │ │ └───────────────────────  PAUSE (or CTRL-NUM LOCK) active 
  1853.  │ │ │ └─────────────────────────  SCROLL LOCK pressed
  1854.  │ │ └───────────────────────────  NUM LOCK pressed
  1855.  │ └─────────────────────────────  CAPS LOCK pressed
  1856.  └───────────────────────────────  INSERT key pressed
  1857.  
  1858. See the CAPSLOCK, NUMLOCK and SCRLOCK functions for a method of setting or
  1859. reading the status of specific control keys.
  1860.  
  1861.  
  1862. KEYFLUSH
  1863.  
  1864. This procedure flushes the keyboard type-ahead buffer and discards any
  1865. keystrokes which have not yet been processed.
  1866.  
  1867. No calling parameters are required.
  1868.  
  1869. DECLARE SUB KeyFlush ()
  1870.  
  1871. Note:       KEYFLUSH may not work properly if you have installed
  1872.             keystroke enhancement software which moves the type-ahead
  1873.             buffer to another location in memory. It DOES work with
  1874.             command-line buffers like IBM's DOSEDIT, however.
  1875.  
  1876.  
  1877. KEYIN
  1878.  
  1879. Similar to the QuickBASIC INKEY$ function, except that it waits for a
  1880. keypress instead of returning at once if none is available.
  1881.  
  1882. No calling parameters are required.
  1883.  
  1884. DECLARE FUNCTION KeyIn% ()
  1885.  
  1886. The function returns a numeric value between 0 and 255 which represents
  1887. the ASCII code of the key pressed. If one of the function keys (F1 to F12)
  1888. or a special key such as PAGEUP or one of the cursor arrows is pressed,
  1889. then a negative value is returned. Converting this number to its absolute
  1890. equivalent produces the scan code of the key.
  1891.  
  1892. Example:  KeyPress% = KeyIn%
  1893.           IF KeyPress% < 0 THEN
  1894.              ScanCode% = ABS(KeyPress%)
  1895.           ELSE
  1896.              AsciCode% = KeyPress%
  1897.           END IF
  1898.  
  1899. See the ASCICODE topic for a list of ASCII codes and their equivalent
  1900. printable characters. The SCANCODE topic lists the scan codes returned by
  1901. the various function and control keys.
  1902.  
  1903. The KEYIN function will recognise if one of the new 101/102 extended
  1904. keyboards is being used and return the correct scan codes for the extra
  1905. keys such as F11 and F12.
  1906.  
  1907.  
  1908. KEYSTAT
  1909.  
  1910. This function tests to see if a keystroke is waiting to be read. It does
  1911. not read or remove the keystroke from the typeahead buffer, use KEYIN% or
  1912. INKEY$ to do this.
  1913.  
  1914. No calling parameters are required.
  1915.  
  1916. DECLARE FUNCTION KeyStat% ()
  1917.  
  1918. KEYSTAT returns -1 (logical TRUE) if a keystroke is waiting to be
  1919. collected or 0 (logical FALSE) if the typeahead buffer is empty.
  1920.  
  1921.  
  1922. LEGALNAME
  1923.  
  1924. This function returns TRUE or FALSE to indicate if the filespec passed to
  1925. it is legal. To do this, each character in the string is compared with a
  1926. set of illegal characters. If none are found a further check is made to
  1927. ensure there are no more than eight characters in the name and three in
  1928. the extension.
  1929.  
  1930. FUNCTION LegalName% (FileSpec$)
  1931.  
  1932.  
  1933. LINEUP
  1934.  
  1935. Returns a string representation of a numeric value. If COMMA% is TRUE
  1936. (non-zero) then the string has commas inserted between every group of
  1937. three digits to the left of the decimal. If LENGTH% is non-zero then the
  1938. resulting string is left padded with spaces to produce a string of the
  1939. required length. If CURRENCY$ is not null, the character it contains will
  1940. be prefixed to the returned string.
  1941.  
  1942. DECLARE FUNCTION LineUp$ (Num#, Places%, Comma%, Length%, Currency$)
  1943.  
  1944.  
  1945. LOBYTE
  1946.  
  1947. Returns the value contained in the Least Significant Byte (LSB) of a
  1948. two-byte integer. This is effectively the remainder obtained after
  1949. dividing the number by 256 (Number% MOD 256).
  1950.  
  1951. DECLARE FUNCTION LoByte% (BYVAL Number%)
  1952.  
  1953. See HIBYTE for a function which returns the Most Significant Byte
  1954. (MSB) of an integer.
  1955.  
  1956.  
  1957. LONGDATE
  1958.  
  1959. This function accepts a three-part numeric date and transcribes it into
  1960. a string containing the date in words. This includes the day of the week,
  1961. which is obtained by calling DOS's internal time and date services. DOS
  1962. is also used to check for an invalid date.
  1963.  
  1964. DECLARE FUNCTION LongDate$(Day%, Month%, Year%)
  1965.  
  1966. LONGDATE returns a null string if the arguments passed evaluate to an
  1967. illegal date (eg 29/2/1989).
  1968.  
  1969.  
  1970. LOWORD
  1971.  
  1972. Returns the value contained in the Least Significant Word (LSW) of a
  1973. four-byte long integer. This is effectively the remainder obtained
  1974. after dividing the number by 65536 (Number% MOD 65536).
  1975.  
  1976. DECLARE FUNCTION LoWord% (BYVAL Number&)
  1977.  
  1978. See HIWORD for a function which returns the Most Significant Word
  1979. (MSW) of a long integer.
  1980.  
  1981.  
  1982. LPTSWAP
  1983.  
  1984. This procedure swaps the port addresses of the two printer channels
  1985. specified so that, for example, all output targeted to LPT1: will actually
  1986. be sent to LPT4:, and vice-versa.
  1987.  
  1988. DECLARE SUB LptSwap (BYVAL Printer1%, BYVAL Printer2%)
  1989.  
  1990. Printer1% and Printer2% are both numeric values in the range 1 - 4, where
  1991. 1 = LPT1:, 2 = LPT2:, etc.
  1992.  
  1993. Note:       any changes made using LPTSWAP will remain in effect 
  1994.             even after your program is finished.
  1995.  
  1996.  
  1997. MASTRENV
  1998.  
  1999. Gets a pointer to the segment of the DOS Master Environment.
  2000.  
  2001. DECLARE FUNCTION MastrEnv% ()
  2002.  
  2003. The QuickBASIC ENVIRON and ENVIRON$ routines allow you to read or set
  2004. variables in the copy of the environment which DOS attaches to your
  2005. program when it starts up. However, because this is only a copy, any
  2006. changes you make to environment variables are lost when the current
  2007. program shuts down. If you want any changes made to variables to be
  2008. passed on to subsequent programs, then you need to make them to DOS's
  2009. Master Environment, which is maintained in low memory.
  2010.  
  2011. This function uses an undocumented interrupt service to obtain the
  2012. address of the first Memory Control Block (MCB) and then follows the
  2013. chain until the Master Environment segment is located. If it fails
  2014. to find it, then a value of zero is returned.
  2015.  
  2016. Once the Master Environment segment is found, your are responsible
  2017. for reading or making any changes to it. Use the FARPEEK and FARPOKE
  2018. routines for this, but proceed with caution. Any changes you make
  2019. will remain in effect until the host computer is rebooted.
  2020.  
  2021.  
  2022. MATCH
  2023.  
  2024. Returns the starting position of a string of characters within
  2025. a larger string.
  2026.  
  2027. DECLARE FUNCTION Match% (Start%, Search$, Pattern$)
  2028.  
  2029. Call with:  Start%   = character position in search string to
  2030.                        start searching from
  2031.             Search$  = String to search
  2032.             Pattern$ = String expression to search for 
  2033.  
  2034. Returns:    Position of first character of Pattern$ in Search$
  2035.             (0 if Pattern$ is not found)
  2036.  
  2037. Wildcards:  #   match any numeric character
  2038.             !   match any alphabetic character
  2039.             ?   match any character
  2040.  
  2041.             \   indicates that the next character in the string
  2042.                 to search for is literal, not a wildcard.
  2043.  
  2044. This function is similar to INSTR but allows the use of wildcards. It is
  2045. based on the MATCH function provided by Digital Research's C-BASIC.
  2046.  
  2047.  
  2048. MATHSCHIP
  2049.  
  2050. Checks to see if a floating-point maths co-processor is installed in the
  2051. system. 
  2052.  
  2053. No calling parameters are required.
  2054.  
  2055. DECLARE FUNCTION MathsChip% ()
  2056.  
  2057. MATHSCHIP returns 0 (logical FALSE) if no co-processor is available. A
  2058. non-zero value indicates that a co-processor is available and, in this
  2059. case, the function will attempt to identify it. Possible return values
  2060. are:
  2061.  
  2062.      87 =   Intel 8087
  2063.     287 =   Intel 80287
  2064.     387 =   Intel 80387 (or 80486 with built-in maths processor)
  2065.  
  2066. Waitek and other models return the same values as their Intel equivalents.
  2067.  
  2068.  
  2069. MCGACOPY
  2070.  
  2071. Copies an MCGA screen to or from a user-supplied dynamic array.
  2072.  
  2073. DECLARE SUB McgaCopy (BYVAL Switch%, SEG Array)
  2074.  
  2075. SWITCH%     Direction of copy   0 = copy screen to string
  2076.                                 1 = copy string to screen
  2077.  
  2078. ARRAY       Dynamic INTEGER or LONG integer array to hold the screen
  2079.             image. It must contain at least 64000 bytes of storage
  2080.             (32000 elements for INTEGER or 16000 for LONG) or the
  2081.             routine will fail, with possibly disastrous results.
  2082.  
  2083. Note:       It is not enough just to pass the name of the storage
  2084.             array to MCGACOPY. You must explicitly name the element
  2085.             where screen storage is to start, eg:
  2086.  
  2087.             DIM ScreenArray(1 TO 32000) AS INTEGER
  2088.             SCREEN 13
  2089.                 .
  2090.             draw some stuff
  2091.                 .
  2092.             McgaCopy 0, ScreenArray(1)
  2093.  
  2094.  
  2095. The QuickBASIC PCOPY statement is very useful for storing screen pages in
  2096. memory, so that they can be kept out of sight until needed. Unfortunately
  2097. it only works in text modes or, on computers with EGA or VGA video cards,
  2098. in SCREEN modes 7 to 12. This routine, on the other hand, works only in
  2099. the MCGA display mode (SCREEN 13), it provides a useful alternative to the
  2100. PCOPY statement for use with medium-resolution 256-colour screens.
  2101.  
  2102. See CGACOPY for a version that can be used with SCREEN 1 and 2 displays.
  2103.  
  2104.  
  2105. MCGASCROLL
  2106.  
  2107. Scrolls a rectangular portion of a SCREEN 13 (320 x 200 256-colour)
  2108. display one pixel to the left or right, wrapping those pixels which are
  2109. scrolled out at the end round to the beginning again.
  2110.  
  2111. DECLARE SUB McgaScroll (BYVAL xLoc%, BYVAL yLoc%, BYVAL xPixels%,_
  2112.                         BYVAL yPixels%, BYVAL Direction%)                 
  2113.  
  2114. XLOC%       The horizontal (X) co-ordinate of the top-left corner of
  2115.             the rectangle to be scrolled.
  2116.  
  2117. YLOC%       The vertical (Y) co-ordinate of the top-left corner of
  2118.             the rectangle to be scrolled.
  2119.  
  2120. XPIXELS%    The width (in pixels) of the rectangle to be scrolled.
  2121.  
  2122. YPIXELS%    The height (in pixels) of the rectangle to be scrolled.
  2123.  
  2124. DIRECTION%  The direction in which the rectangle contents are to be
  2125.             scrolled (0 = Left, 1 = Right).
  2126.  
  2127. Co-ordinates are in the ranges:  X >= 0 <= 319, Y >= 0 <= 199
  2128.  
  2129.  
  2130. MCGATEXT
  2131.  
  2132. Writes characters to the screen in the 320 x 200  256-colour graphics
  2133. mode (SCREEN 13).
  2134.  
  2135. DECLARE SUB McgaText (BYVAL xLoc%, BYVAL yLoc%, Text$,_
  2136.                       BYVAL Attr%, BYVAL Scale%)
  2137.  
  2138. This routine provides a convenient way of displaying text in SCREEN 13
  2139. without having to bother about loading external font files. It uses the
  2140. standard character definition tables built into your display adaptor, but
  2141. allows you to scale them up to eight times normal size and to specify any
  2142. combination of foreground and background colours.
  2143.  
  2144. XLOC%       The horizontal co-ordinate of the top left hand pixel
  2145.             from which the text will begin (0 - 319).
  2146.  
  2147. YLOC%       The vertical co-ordinate of the top left hand pixel
  2148.             from which the text will begin (0 - 199).
  2149.  
  2150. TEXT$       The string of text to be displayed (up to 63 characters).
  2151.  
  2152. ATTR%       The colour (or display attribute in monochrome modes) to
  2153.             be given to the text. This is calculated by the formula:
  2154.  
  2155.             Colour% = (Background% * 256) + Foreground%
  2156.  
  2157.             Foreground is in the range (0 - 255) and Background (0 - 64).
  2158.             The actual colours displayed depend upon your current PALETTE
  2159.             settings.
  2160.  
  2161.             Note:   supplying a value of -1 for background prevents
  2162.                     background pixels from being changed at all. This
  2163.                     allows text to be blended more naturally into a
  2164.                     complex graphics display.
  2165.  
  2166. SCALE%      The character size of the text to be displayed. This ranges
  2167.             from 1 to 8, where 1 is standard 40-column text and where 8
  2168.             multiplies the character size by eight on both the horizontal
  2169.             and vertical axes.
  2170.  
  2171. The complete extended ASCII character set is supported, including foreign
  2172. symbols and box-drawing characters.
  2173.  
  2174. Since MCGATEXT does not support clipping, to ensure a clean display you
  2175. must ensure that the text to be output fits within the current screen
  2176. boundaries.
  2177.  
  2178. See also CGATEXT for displaying characters in SCREEN 1 and VGATEXT for
  2179. displaying characters in SCREENs 7-12.
  2180.  
  2181.  
  2182. MEDIA
  2183.  
  2184. Gets or sets the volume label and/or serial number of the specified
  2185. disk drive. Also returns the file system (FAT) type. This procedure
  2186. only works with DOS 5.0 or greater.
  2187.  
  2188. DECLARE SUB Media (Set%, Drive$, Volume$, Serial$, FileSy$)
  2189.  
  2190. Set%    =   FALSE (zero) Get media information.
  2191.             TRUE (non-zero) Set media information.
  2192. Drive$  =   The drive letter of the disk to be processed. A colon
  2193.             may be included although it is not necessary. If Drive$
  2194.             is a null string then the default, currently-logged, 
  2195.             drive is assumed.
  2196. Volume$ =   The disk volume label (maximum 11 characters). If this
  2197.             is a null string and Set% = TRUE, then the existing label
  2198.             is not changed. To blank out an existing volume label,
  2199.             fill Volume$ with at least one ASCII space character,
  2200. Serial$ =   The disk serial number (8 hexadecimal characters). If
  2201.             this is a null string and Set% = TRUE, then the existing
  2202.             serial number is not changed. When setting a new serial
  2203.             number do not include the intervening colon.
  2204. FileSy$ =   The file system in use on the specified drive. Under DOS 5
  2205.             this is either 12-bit or 16-bit FAT. Provided for information
  2206.             only, you cannot change it except by reformatting the drive.
  2207.  
  2208. Note that the Volume Label is the one written that is written into the
  2209. Boot Record when the disk is formatted and is not necessarily the same
  2210. as the one set or returned by the DOS LABEL command.
  2211.  
  2212.  
  2213. MISTAKE
  2214.  
  2215. Displays the error message supplied in a dialogue box and waits for the
  2216. operator to press the <ENTER> key before returning, restoring the screen
  2217. to its' previous state.
  2218.  
  2219. DECLARE SUB MisTake (BYVAL Row%, Message$, BYVAL Attr%, BYVAL Mouse%)
  2220.  
  2221. ROW%        The top row of the dialogue box when it is displayed. The
  2222.             box is automatically centered within this row, which may be
  2223.             adjusted so that it remains within the screen boundaries.
  2224.  
  2225. MESSAGE$    A string of text comprising the error message to be displayed.
  2226.             It must be no longer than 40 characters otherwise it will be
  2227.             truncated to fit inside the display panel.
  2228.  
  2229. ATTR%       The display attribute or colour to be given to the dialogue box.
  2230.             If an argument of zero is supplied, the box is displayed with
  2231.             bright yellow foreground on a red background (colour monitors)
  2232.             or in reverse video (monochrome monitors). On colour displays the
  2233.             message text is always given a white foreground, no matter what
  2234.             attribute is specified.
  2235.  
  2236. MOUSE%     Should be set to TRUE (-1) or FALSE (0) to indicate if a
  2237.             mouse is available for use. If available, the operator can
  2238.             respond by clicking the left mouse button while the cursor is
  2239.             positioned on the radio button.     
  2240.  
  2241. This routine is a special case of the INFORM dialogue box procedure (see
  2242. above) which can be used for any general-purpose messages which require an
  2243. acknowledgement from the operator.
  2244.  
  2245.  
  2246. MOUSEBORDER
  2247.  
  2248. Sets the maximum and minimum boundaries for mouse movement, both
  2249. horizontally and vertically.
  2250.  
  2251. DECLARE SUB MouseBorder (BYVAL x1%, BYVAL y1%, BYVAL x2%, BYVAL y2%)
  2252.  
  2253. This routine defines a screen rectangle into which the mouse cursor
  2254. is confined. x1% - y1% are the pixel co-ordinates of the upper-left
  2255. corner and x2% - y2% the pixel co-ordinates of the lower-right. If
  2256. the upper-left co-ordinates are greater than the lower-right then
  2257. the two sets of values will be swapped.
  2258.  
  2259. If the current mouse pointer is outside the defined rectangle, then
  2260. it will be moved inside it.
  2261.  
  2262.  
  2263. MOUSEHIDE
  2264.  
  2265. Make the mouse cursor invisible. 
  2266.  
  2267. DECLARE SUB MouseHide ()
  2268.  
  2269.  
  2270. MOUSEINIT
  2271.  
  2272. Initialises the mouse driver and returns the driver status. Also hides
  2273. the mouse cursor if it was previously visible.
  2274.  
  2275. DECLARE FUNCTION MouseInit% ()
  2276.  
  2277. Returns TRUE (-1) if mouse support is available or FALSE (0) if not.
  2278.  
  2279.  
  2280. MOUSEMICKEY
  2281.  
  2282. Read mouse motion counters.
  2283.  
  2284. Return the number of horizontal and vertical mickeys moved since the
  2285. last mouse function call.
  2286.  
  2287. DECLARE SUB MouseMickey (horizontal%, vertical%)
  2288.  
  2289. The returned values represent the net mouse pointer displacement since
  2290. this routine was last called. A positive number indicates movement to
  2291. the right or downward. Negative values indicate travel to the left or
  2292. upwards. One mickey is approximately 1/200" of mouse movement.
  2293.  
  2294.  
  2295. MOUSENOW
  2296.  
  2297. Returns the current state of the mouse.
  2298.  
  2299. DECLARE SUB MouseNow (leftButton%, rightButton%, xMouse%, yMouse%)
  2300.  
  2301. If leftButton% or rightButton% are TRUE (-1) than that button is
  2302. currently being pressed, otherwise they are set to FALSE (0).
  2303. xMouse% and yMouse% contain the current horizontal and vertical 
  2304. pixel co-ordinates of the mouse pointer.
  2305.  
  2306.  
  2307. MOUSEPRESSLEFT
  2308.  
  2309. Returns the mouse state at the last press of the left button.
  2310.  
  2311. DECLARE SUB MousePressLeft (leftCount%, xMouse%, yMouse%)
  2312.  
  2313. leftCount% returns the number of presses that have been made on the 
  2314. left mouse button since this routine was last called. xMouse% and
  2315. yMouse% contain the horizontal and vertical pixel co-ordinates of
  2316. the mouse pointer at the last button press (left or right).
  2317.  
  2318. Calling this procedure resets the left button press counter to zero.
  2319.  
  2320.  
  2321. MOUSEPRESSRIGHT
  2322.  
  2323. Returns the mouse state at the last press of the right button.
  2324.  
  2325. DECLARE SUB MousePressRight (rightCount%, xMouse%, yMouse%)
  2326.  
  2327. rightCount% returns the number of presses that have been made on the 
  2328. right mouse button since this routine was last called. xMouse% and
  2329. yMouse% contain the horizontal and vertical pixel co-ordinates of
  2330. the mouse pointer at the last button press (left or right).
  2331.  
  2332. Calling this procedure resets the right button press counter to zero.
  2333.  
  2334.  
  2335. MOUSEPUT
  2336.  
  2337. Sets the mouse cursor position.
  2338.  
  2339. DECLARE SUB MousePut (BYVAL xMouse%, BYVAL yMouse%)
  2340.  
  2341. xMouse% and yMouse% are the horizontal and vertical pixel co-ordinates
  2342. of the screen location where the mouse pointer is to be moved. This
  2343. position is adjusted, if necessary, to lie within the limits specified
  2344. by a previous call to MOUSEBORDER (see above).
  2345.  
  2346.  
  2347. MOUSERELLEFT
  2348.  
  2349. Returns the mouse state at the last release of the left mouse button.
  2350.  
  2351. DECLARE SUB MouseRelLeft (leftCount%, xMouse%, yMouse%)
  2352.  
  2353. leftCount% returns the number of times the left mouse button has been
  2354. released since this procedure was last called. xMouse% and yMouse%
  2355. contain the horizontal and vertical pixel co-ordinates of the mouse
  2356. pointer at the last button release (left or right).
  2357.  
  2358. Calling this routine resets the left button release counter to zero.
  2359.  
  2360.  
  2361. MOUSERELRIGHT
  2362.  
  2363. Returns the mouse state at the last release of the right mouse button.
  2364.  
  2365. DECLARE SUB MouseRelRight (rightCount%, xMouse%, yMouse%)
  2366.  
  2367. rightCount% returns the number of times the right mouse button has been
  2368. released since this procedure was last called. xMouse% and yMouse%
  2369. contain the horizontal and vertical pixel co-ordinates of the mouse
  2370. pointer at the last button release (left or right).
  2371.  
  2372. Calling this routine resets the right button release counter to zero.
  2373.  
  2374.  
  2375. MOUSERESTORE
  2376.  
  2377. Restores the mouse pointer to the position and state that was in
  2378. effect at the previous call to MOUSESAVE (see below).
  2379.  
  2380. DECLARE SUB MouseRestore ()
  2381.  
  2382.  
  2383. MOUSESAVE
  2384.  
  2385. Saves the current mouse pointer state and screen location in an
  2386. internal buffer.
  2387.  
  2388. DECLARE SUB MouseSave ()
  2389.  
  2390. The MOUSERESTORE procedure (see above) can be used to restore
  2391. the mouse pointer state.
  2392.  
  2393.  
  2394. MOUSESHOW
  2395.  
  2396. Makes the mouse cursor visible.
  2397.  
  2398. DECLARE SUB MouseShow ()
  2399.  
  2400.  
  2401. MOUSESPEED
  2402.  
  2403. Sets the mouse mickeys to pixels ratio.
  2404.  
  2405. DECLARE SUB MouseSpeed (BYVAL horizontal%, BYVAL vertical%)
  2406.  
  2407. Sets the number of mickeys that are equivalent to 8 screen pixels for
  2408. horizontal and vertical mouse movement. One mickey is approximately
  2409. 1/200" of physical mouse motion.
  2410.  
  2411.  
  2412. MOUSEWARP
  2413.  
  2414. Set the double-speed threshold.
  2415.  
  2416. DECLARE SUB MouseWarp (BYVAL threshold%)
  2417.  
  2418. Defines the threshold for doubling the speed of mouse pointer travel.
  2419. The threshold% value is supplied in mickeys/second (default = 64).
  2420. Doubling of pointer speed can be effectively disabled by setting the
  2421. threshold to a very large value (such as 32,767).
  2422.  
  2423.  
  2424. NETTEST
  2425.  
  2426. This function is used to detect if the program which calls it is running
  2427. under a Novell Network. It can be used to decide if file or record locking
  2428. is required.
  2429.  
  2430. No calling parameters are required.
  2431.  
  2432. DECLARE FUNCTION NetTest% ()
  2433.  
  2434. Returns -1 (logical TRUE) if the Network shell is present and 0 (logical
  2435. FALSE) if not. Note that the function cannot distinguish between programs
  2436. running on a local or network drive under NetWare.
  2437.  
  2438. The SHARING function (below) provides similar information for file-sharing
  2439. using DOS's SHARE.EXE program.
  2440.  
  2441.  
  2442. NEXTWORD
  2443.  
  2444. Extracts the first word from a string.
  2445.  
  2446. DECLARE FUNCTION NextWord$ (Last$)
  2447.  
  2448. This function extracts the first complete word from a string of
  2449. text and pads it with a single leading and trailing space. The
  2450. returned word is actually removed from string which was passed
  2451. to NEXTWORD so the function can be called repeatedly to extract
  2452. each word until LAST$ is empty.
  2453.  
  2454.  
  2455. NUMBERDAY
  2456.  
  2457. Splits a Julian date number into day, month and year and also returns the
  2458. day of the week as a number between 0 and 6 (0 = Sunday etc..)
  2459.  
  2460. DECLARE FUNCTION NumberDay% (Number&, Day%, Month%, Year%)
  2461.  
  2462.  
  2463. NUMLOCK
  2464.  
  2465. Toggles NUM LOCK on or off or, alternatively, reads the current NUM LOCK
  2466. key setting.
  2467.  
  2468. DECLARE FUNCTION NumLock% (BYVAL Switch%)
  2469.  
  2470. Switch% = 0  Turns NUM LOCK off
  2471.         = 1  Turns NUM LOCK on
  2472.  
  2473. Any other value just returns the current NUM status as a logical value
  2474. where -1 (TRUE) means that NUM LOCK is on and 0 (FALSE) means that NUM
  2475. LOCK is off.
  2476.  
  2477.  
  2478. PANEL
  2479.  
  2480. This procedure is used to produce rectangular boxes, upon the video
  2481. display, of various shapes and colours. The calling program should supply
  2482. the row/column co-ordinate of the top, left-hand corner of the required
  2483. panel, its height in rows and width in columns. You should also specify
  2484. the display attribute that the panel will be displayed in and the border
  2485. style to frame it with.
  2486.  
  2487. DECLARE SUB Panel (Row%, Col%, Rows%, Cols%, Border%, Attr%)
  2488.  
  2489. Panels can be drawn with the following border styles:
  2490.  
  2491. ┌───┐         ╔═══╗         ╓───╖        ╒═══╕
  2492. │ 1 │         ║ 2 ║         ║ 3 ║        │ 4 │
  2493. └───┘         ╚═══╝         ╙───╜        ╘═══╛
  2494.  
  2495. Any other value draws the panel without a border.
  2496.  
  2497. Although the boxes drawn by PANEL resemble popup windows, you cannot
  2498. restore the screen contents overwritten by a box once it has been drawn.
  2499. See the POPUP and SHUTUP routines, however, for a full windowing
  2500. system which does preserve the display.
  2501.  
  2502.  
  2503. PARALLELPORTS
  2504.  
  2505. This function checks how many hardware printer ports are available. It
  2506. does not check to see if an actual printer is connected to each of them,
  2507. use the PRINTEST or PRINTERSTAT functions (see below) to obtain this
  2508. information.
  2509.  
  2510. No calling parameters are required.
  2511.  
  2512. DECLARE FUNCTION ParallelPorts% ()
  2513.  
  2514.  
  2515. PARKHEADS
  2516.  
  2517. Parks the heads of each fixed disk drive in the system onto the last
  2518. cylinder of the disk, preparatory to powering off.
  2519.  
  2520. DECLARE SUB ParkHeads ()
  2521.  
  2522. This routine only works reliablly on AT class computers and above.
  2523. Using it on an XT may simply cause the computer to 'hang', without
  2524. parking the heads.
  2525.  
  2526.  
  2527. PAUSE
  2528.  
  2529. This routine is used to generate machine-independent timing loops. It
  2530. simply pauses until the specified number of clock ticks have elapsed.
  2531.  
  2532. DECLARE SUB Pause (BYVAL Ticks%)
  2533.  
  2534. There are 18.2 clock ticks per second on all PCs, no matter what the
  2535. processor or processor speed.
  2536.  
  2537.  
  2538. PEEKWORD
  2539.  
  2540. Reads a long integer value from two consecutive bytes of memory.
  2541.  
  2542. DECLARE FUNCTION PeekWord& (BYVAL Segment&, BYVAL Offset&)
  2543.  
  2544. Arguments:  Segment&  = address of memory segment containing the data
  2545.                         to be read.
  2546.             Offset&   = offset address, within the segment of the 
  2547.                         two bytes to be read.
  2548.  
  2549. Returns:    contents of the two consecutive bytes in the form of a
  2550.             long integer value in the range (0 to 65535). 
  2551.  
  2552. Note:       parameters are passed as LONG integers to save you the
  2553.             hassle of having to convert argument values over 32767
  2554.             to negative signed integers. Do not use values greater
  2555.             than 65535, however, or the most significant word will
  2556.             be ignored and the address converted to Modulus 65536.
  2557.  
  2558.             If you supply an offset address of 65535 (0FFFFh) which
  2559.             would cause the second byte to cross a segment boundary,
  2560.             only the lower byte is read and returned as a value
  2561.             between (0 - 255).
  2562.  
  2563. Using QuickBASIC's PEEK function to examine data which lies outside
  2564. of DGROUP is a pain. You also have to use DEF SEG to set the segment
  2565. required and then to reset it afterwards. This function allows you to
  2566. read data, directly, from anywhere in the 1 megabyte of addressable
  2567. RAM space your computer contains. It also reads two adjacent bytes of
  2568. data from the address supplied and converts them to a single integer.
  2569.  
  2570. The PC architecture follows the Intel convention of storing 'words'
  2571. (two-byte values) with the Least Significant part in the lower byte
  2572. (LSB) and the Most Significant (MSB) in the higher byte. Since each
  2573. byte can only hold 256 possible values (0 to 255), an integer which
  2574. has a range of from 0 to 65535 (unsigned) is stored in consecutive
  2575. bytes with the MSB being considered the number of times it can be
  2576. divided by 256 and the LSB being the remainder of this division. The
  2577. number 1000, for example would be stored in memory as follows:
  2578.  
  2579.                          LSB              MSB
  2580.                  ┌─┬─┬─┬─┬─┬─┬─┬─┐ ┌─┬─┬─┬─┬─┬─┬─┬─┐
  2581. 1000 (decimal) = │1│1│1│0│1│0│0│0│ │0│0│0│0│0│0│1│1│
  2582.                  └─┴─┴─┴─┴─┴─┴─┴─┘ └─┴─┴─┴─┴─┴─┴─┴─┘
  2583.  
  2584.                  1000 MOD 256 = 232   1000 \ 256 = 3
  2585.  
  2586. To convert the two bytes back to a single integer again, you would
  2587. use the formula: 
  2588.  
  2589.                         x = (MSB * 256) + LSB 
  2590.  
  2591. or, in our example:     x = 3 * 256 + 232 = 1000
  2592.  
  2593. PEEKWORD makes this conversion for you automatically, all you have to
  2594. do is supply the address and it returns the contents of the two bytes
  2595. in long integer format.
  2596.  
  2597. The POKEWORD procedure (below) complements PEEKWORD by allowing you
  2598. to write a word of data anywhere in the 1MB addressable PC workspace.
  2599.  
  2600. See also FARPEEK and FARPOKE which allow you to read from and write
  2601. to far memory, one byte at a time.
  2602.  
  2603.  
  2604. PERCENTBOX
  2605.  
  2606. Opens and maintains a popup window which displays a percentage value
  2607. as a horizontal bar.
  2608.  
  2609. DECLARE SUB PerCentBox (BYVAL Switch%, Message$, BYVAL Attr%,_
  2610.                         BYVAL PerCent%)
  2611.  
  2612. Arguments:  Switch%   = 1  open percentage box window
  2613.                       = 2  maintain percentage bar
  2614.                       = 3  close percentage box
  2615.                       
  2616.             Message$  = an optional message which is centred in the
  2617.                         percentage box window (Switch% = 1).
  2618.                         
  2619.             Attr%     = display colour or attribute for percentage
  2620.                         box window and text. If Attr% = 0 attribute
  2621.                         defaults to 48 (Black on Cyan) for colour
  2622.                         adaptors and 112 (Reverse) for monochrome.
  2623.                         (used only with Switch% = 1)
  2624.                         
  2625.             PerCent%  = an integer value between 0 and 100 which
  2626.                         controls the length of the percentage bar.
  2627.                         (used only with Switch% = 2)            
  2628.  
  2629. Here is another useful little routine for Toolbox users. It pops up a
  2630. window in which is displayed a percentage bar, illustrating how much
  2631. of the current process has been completed. Use it, during lengthy
  2632. operations, to reassure an operator that the program is not 'hanging',
  2633. or to indicate how much longer there is to go.
  2634.  
  2635. The Percentage Box window is popped up, centered, on the screen. It
  2636. recognises 43 and 50 line displays and will adjust itself accordingly.
  2637. Only one Percentage Box can be open at a time, although other windows
  2638. and dialogue boxes may be opened and closed while it is present. Be
  2639. careful not to overlap the Percentage Box with other windows, though.
  2640.  
  2641.  
  2642. POKEWORD
  2643.  
  2644. Writes an integer value into two consecutive bytes of memory.
  2645.  
  2646. DECLARE SUB PokeWord (BYVAL Segment&, BYVAL Offset&, BYVAL Word&)
  2647.  
  2648. Arguments:  Segment&  = address of memory segment containing the
  2649.                         location to be written to
  2650.             Offset&   = offset address, within the segment of the 
  2651.                         two bytes to be set.
  2652.             Word&     = the value to set in memory. It must be a
  2653.                         value in the range 0 to 65535.
  2654.  
  2655. The data is written in standard Intel format, with the Most
  2656. Significant part of the number (MSB) being written into the higher
  2657. of the two bytes.
  2658.  
  2659. Note:       if you supply an offset address of 65535 (0FFFFh) which
  2660.             would cause the second byte to cross a segment boundary,
  2661.             only the lower, least significant, byte (LSB) is written.
  2662.  
  2663.             Parameters are passed as LONG integers to save you the
  2664.             hassle of having to convert argument values over 32767
  2665.             to negative signed integers. Do not use values greater
  2666.             than 65535, however, or the most significant word will
  2667.             be ignored and the address converted to Modulus 65536.
  2668.  
  2669. The PEEKWORD procedure (above) complements POKEWORD by allowing you
  2670. to read a word of data from anywhere in the 1MB of addressable PC
  2671. memory.
  2672.  
  2673. See also FARPEEK and FARPOKE which allow you to read from and write
  2674. to far memory, one byte at a time.
  2675.  
  2676.  
  2677. POPUP
  2678.  
  2679. This is the Toolbox popup window generator. What are Windows?  Well if
  2680. you've used the QuickBASIC environment at all then you've used Windows.
  2681. When you press <ALT><F> to bring down the File Menu, the list of options
  2682. presented there is in a window. Notice how any characters which were
  2683. concealed when the File Menu appeared, are restored, intact, after you've
  2684. made your choice. Windows are areas of the screen which are used to hold
  2685. transient data and messages to the user. They make the most of the limited
  2686. display space available and remove the need to constantly rebuild the
  2687. screen, each time your program communicates with the world.
  2688.  
  2689. Properly  presented, windows can give the illusion of multi-tasking, even
  2690. on single-processor machines like the IBM-PC.
  2691.  
  2692. Nowadays, no program worth its' salt can be without a window of some kind.
  2693. If YOUR program is going to stand out amongst all the others, however,
  2694. they've got to be done professionally. Windows must appear instantly and
  2695. vanish, just as quickly, when no longer required. They must be as large or
  2696. as small as is necessary, for the data which you need to display, and you
  2697. should have a plentiful supply, for all the circumstances that your
  2698. program might encounter. BASIC, unfortunately, is just not fast enough to
  2699. meet all these requirements.
  2700.  
  2701. Looks like it'll have to be Assembly-Language again ...
  2702.  
  2703. DECLARE SUB PopUp (BYVAL Row%, BYVAL Col%, BYVAL Hght%, BYVAL Wdth%,_
  2704.                    BYVAL Attr%, BYVAL Brdr%, BYVAL Shdw%, BYVAL Zoom%)
  2705.  
  2706. Opens a popup window at the screen location specified.
  2707.  
  2708. Where:    P1%  is the top-left row co-ordinate
  2709.           P2%  is the top-left column co-ordinate
  2710.           P3%  is the height (in rows) of the window
  2711.           P4%  is the width (in columns) of the window
  2712.           P5%  is the display attribute or colour
  2713.           P6%  is the border style (0 = no border)
  2714.           P7%  is the shadow switch (0 = no shadow)
  2715.           P8%  is the zoom switch (0 = no zoom)
  2716.  
  2717. The first four parameters specify the size of the window and the location
  2718. on the screen at which it will appear. Border styles are as follows:
  2719.  
  2720. ┌────┐
  2721. │ 1. │    Single-lined box all round the window
  2722. └────┘
  2723. ╔════╗
  2724. ║ 2. ║    Double-lined box all round the window
  2725. ╚════╝
  2726. ╒════╕
  2727. │ 3. │    Single vertical, double horizontal
  2728. ╘════╛
  2729. ╓────╖
  2730. ║ 4. ║    Single horizontal, double vertical
  2731. ╙────╜
  2732. ╤════╤
  2733. │ 5. │    Single-lined box all round the window
  2734. ╘════╛
  2735. ╦════╦
  2736. ║ 6. ║    Double-lined box all round the window
  2737. ╚════╝
  2738. ┬────┬
  2739. │ 7. │    Single vertical, double horizontal
  2740. ╘════╛
  2741. ╥────╥
  2742. ║ 8. ║    Single horizontal, double vertical
  2743. ╙────╜
  2744.  
  2745. Border styles 5 through 8 are particularly suitable for use with pull-
  2746. down menus, descending from a horizontal bar.
  2747.  
  2748. The SHADOW switch (Parameter 7), can be used to add a black shadow beneath
  2749. your window, Giving it a three dimensional effect. Setting P7% to 1 puts
  2750. solid shadow on the left-hand side. Setting P7% to 2 puts it on the right.
  2751. values of 3 and 4 in P7% will display transparant shadow to the left or
  2752. right, respectively, any other value prevents shadow.
  2753.  
  2754. Setting Parameter 8 to a non-zero value will cause the window to ZOOM onto
  2755. the screen.  What this means is that, starting at a point source,
  2756. successively larger versions of the window will be drawn until it is the
  2757. size required. The value you supply sets the interval, in milliseconds,
  2758. between iterations and is used to control the speed at which the window
  2759. explodes onto the screen. 
  2760.  
  2761. To preserve compatibility with programs written for use with previous
  2762. versions of the Toolbox, a value of 1 in parameter 8 sets the default
  2763. delay of 20 milliseconds per iteration. At this speed, which is constant
  2764. on PCs with all types of microprocessor, the process is extremely fast
  2765. and impressive, and adds a very professional touch to your programs. 
  2766.  
  2767. Before a window is opened, the display area below it is copied to an
  2768. internal buffer, from where it will be eventually restored when the window
  2769. is closed. This buffer has a capacity of 8 KiloBytes, the equivalent of
  2770. two full screens. To calculate the storage required for a particular
  2771. window, use the formula:
  2772.  
  2773. Bytes = ((Height in rows * Width in columns) * 2) + 6
  2774.  
  2775. (add one row to the height and one column to the width if you specify
  2776. shadow)
  2777.  
  2778. The window area needs to be multiplied by 2 since each screen character
  2779. takes two bytes of memory, for itself and its attribute code. The odd six
  2780. bytes are required for the storage of buffer pointers. The window buffer
  2781. works as a LIFO (Last In First Out) stack, so that the last window opened
  2782. is the first one to be removed. You can close the current window with the
  2783. statement:
  2784.  
  2785. CALL ShutUp
  2786.  
  2787. To put text inside a window, use the FASTPRINT routine (see above). You
  2788. can clear all or part of an open window with SCROLL (see below).
  2789.  
  2790.  
  2791. PRINTERSTAT
  2792.  
  2793. DECLARE FUNCTION PrinterStat% (BYVAL Printer%)
  2794.  
  2795. This function tests the current status of the parallel printer specified.
  2796. The value returned is tested as follows :
  2797.  
  2798.    Bit     Wanted    Meaning
  2799. ─────────────────────────────────────────────────────
  2800.     7        1       Printer not busy (0 = busy)
  2801.     6        0       Printer acknowledges
  2802.     5        0       Out-of-paper
  2803.     4        1       This printer selected
  2804.     3        0       I/O error
  2805.     2        0       Not used
  2806.     1        0       Not used
  2807.     0        0       Time-out occurred
  2808. ─────────────────────────────────────────────────────
  2809.    90 Hex  144 (Decimal)
  2810.  
  2811. Specify the printer to be tested as a number between 1 and 4, where 1 =
  2812. LPT1:, 2 = LPT2:, etc.
  2813.  
  2814. Note:       Some printers also set the acknowledgement bit. If so, the
  2815.             value returned will be 208 (D0 Hex) instead of 144.
  2816.  
  2817.  
  2818. PRINTEST
  2819.  
  2820. This is a simplified version of the PRINTERSTAT function (above). It
  2821. returns a logical value to indicate whether the specified printer is ready
  2822. (TRUE = -1) or not (FALSE = 0).
  2823.  
  2824. DECLARE FUNCTION PrinTest% (BYVAL Printer%)
  2825.  
  2826. Specify the printer to be tested as a number between 1 and 4, where 1 =
  2827. LPT1:, 2 = LPT2:, etc. The function will only work with parallel printers.
  2828.  
  2829.  
  2830. PRINTSET
  2831.  
  2832. Most modern printers have a variety of useful styles and fonts which you
  2833. can select by setting dip switches or sending the appropriate control
  2834. codes from the computer. Unfortunately this is not always convenient,
  2835. especially when you are in the middle of a program and have to duck out to
  2836. set up the proper print size. PRINTSET offers a solution to this problem
  2837. in the form of a pull-down menu which allows you to select from a range of
  2838. printer features, using the 'point-and-shoot' method.
  2839.                                                     
  2840. DECLARE SUB PrintSet (BYVAL Row%, BYVAL Col%, BYVAL Attr%, BYVAL Printer%)
  2841.  
  2842. Where:  Row%     = Row number of the top left-hand corner of the menu
  2843.                    window.
  2844.         Col%     = Column number of the top left-hand corner of the menu
  2845.                    window. 
  2846.         Attr%    = the display attribute or colour which is given to the
  2847.                    menu window.
  2848.         Printer% = the printer number (i.e. 1 = LPT1, 2 = LPT2 etc).
  2849.  
  2850. If you supply a value of zero for the Attr% argument, the menu window will
  2851. take the colour or attribute of the character which will be overlaid by
  2852. the top left corner of the window, when it appears. If this character is
  2853. also a single or double-lined horizontal bar (ASCII 196 or 205), the
  2854. border of the menu will be automatically adjusted to blend in with this
  2855. line, allowing you to produce the appearance of a pulldown menu.
  2856.  
  2857. Note:       Although the Toolbox package contains copies of this module
  2858.             configured for different types of printer, only one version
  2859.             of PrintSet may be in the library at any one time.
  2860.  
  2861.             PRINTEPS.OBJ is for Epson printers
  2862.             PRINTIBM.OBJ is for IBM Grahics printers
  2863.             PRINTPRO.OBJ is for IBM Proprinters
  2864.  
  2865.  
  2866. PROGNAME
  2867.  
  2868. Returns the full filespec of the current program.
  2869.  
  2870. DECLARE FUNCTION ProgName$ ()
  2871.  
  2872. DOS appends the full pathname of the currently-executing program to
  2873. the end of the copy of the environment it gives to it. This function
  2874. searches for the pathname string and returns it to the caller.
  2875.  
  2876.  
  2877. RAMDISK
  2878.  
  2879. Many disk-intensive processes, such as file sorting, will run much faster
  2880. when performed on a ramdisk. In such cases, use this function to test if a
  2881. ramdisk is available and the FREESPACE function (above) to see if it has
  2882. enough space for the job required. Don't forget to copy your data back to
  2883. a physical drive afterwards, or you will lose it when you power off.
  2884.  
  2885. RAMDISK searches the system drive table and examines the device driver for
  2886. each block device to see if it is a ramdisk. If one is detected, the
  2887. function returns the ASCII value of the drive letter associated with it
  2888. (eg 68 = D:). If no ramdisk is present, a value of zero is returned. If
  2889. more than one ramdisk is present in the system, only the first one is
  2890. reported on.
  2891.  
  2892. No calling parameters are required.
  2893.  
  2894. DECLARE FUNCTION RamDisk% ()
  2895.  
  2896. RAMDISK will work reliably with all versions of Microsoft's RAMDRIVE and
  2897. IBM's VDISK. However it has not been tested with any of the more esoteric
  2898. virtual disk products, and may not correctly identify some of these.
  2899.  
  2900.  
  2901. RAND
  2902.  
  2903. Returns a random number. This differs from QuickBASIC's RND function in
  2904. that RAND returns an integer and you can specify the range for this value.
  2905.  
  2906. DECLARE FUNCTION Rand% (BYVAL Lower%, BYVAL Higher%)
  2907.  
  2908. Lower% and Higher% are the upper and lower limits for the random number
  2909. to be returned. If Lower% is greater than Higher% then the arguments will
  2910. be transposed.
  2911.  
  2912.  
  2913. REDIRECT
  2914.  
  2915. This routine is intended to be used in conjunction with the QuickBASIC
  2916. SHELL command. It redirects standard output from a shelled program or
  2917. command to the null device, a printer or a file.
  2918.  
  2919. DECLARE SUB ReDirect (BYVAL Switch%, FileSpec$)
  2920.  
  2921. Arguments:  Switch%     The device output is to be directed to
  2922.  
  2923.                     1   the NULL device (output is discarded)
  2924.                     2   the printer device (make sure it's on)
  2925.                     3   the filename specified.
  2926.                     0   turn off redirection
  2927.  
  2928.             FileSpec$   The full pathname (including drive letter if
  2929.                         necessary) of the file to which output should
  2930.                         be redirected. If it does not already exist,
  2931.                         it will be created. Otherwise it will be
  2932.                         truncated to zero length before output begins.
  2933.                         
  2934. Output redirection will only work on child programs and shelled DOS
  2935. commands. QuickBASIC uses its' own output routines and will ignore
  2936. any such device redirection.
  2937.  
  2938.  
  2939. RESEED
  2940.  
  2941. Reinitialises the random number seed used by the RAND function (above).
  2942.  
  2943. DECLARE SUB ReSeed (BYVAL Seed&)
  2944.  
  2945. Note that the argument passed is a LONG integer. This enables you to use
  2946. the value which is returned by the QuickBASIC TIMER function, eg:
  2947.  
  2948.     ReSeed TIMER
  2949.  
  2950. Note that the Toolbox random number seed is not the same as the one used
  2951. internally by QuickBASIC. You cannot, therefore, start a new sequence of
  2952. QB's RND values by using RESEED nor can you use RANDOMIZE to reinitialise
  2953. the sequence for RAND.
  2954.  
  2955.  
  2956. REVINPUT
  2957.  
  2958. Accepts user input in a Reverse Video entry panel, all the usual editing
  2959. keys are supported and entry may be terminated by either a carriage-return
  2960. or one of several special function keys (see below).
  2961.  
  2962. DECLARE FUNCTION RevInput$ (Max%, Visible%, Default$, Legal$, Ctx%, Topic$,_
  2963.                             Mask%, HotKey%)
  2964.  
  2965. Max%         =  maximum number of characters which can be accepted.
  2966. Visible%     =  maximum number of characters which are visible on the
  2967.                 display. If non-zero and less than Max%, this is the
  2968.                 actual size of the data-entry panel.
  2969.     Note:       the data-entry panel will scroll, if necessary, to
  2970.                 ensure that the current character position is always
  2971.                 visible.      
  2972. Default$     =  default string which can be accepted by just pressing
  2973.                 the <Enter> key.
  2974. Legal$       =  a string of legal characters which are acceptable for
  2975.                 input. If a null string is passed then all printable
  2976.                 characters will be accepted. 
  2977. Ctx%         =  set TRUE if context-sensitive help is available, in
  2978.                 which case ... 
  2979. Topic$       =  name of the HELP Topic file to display whenever the
  2980.                 <F1> key is pressed. 
  2981. Mask%        =  if TRUE (non-zero) prevents the characters entered from
  2982.                 being echoed to the display. Instead an asterisk (*) is
  2983.                 displayed for each character position although the entry
  2984.                 string itself is unaffected. Use this for passwords.
  2985. HotKey%      =  If entry is terminated by anything other than the
  2986.                 <Enter> key, this variable will contain an explanatory
  2987.                 return code ..
  2988.  
  2989. Return Codes:   1  =  <Escape> abort entry returning a null string
  2990.                 2  =  <F2>     repeat previous entry for this field
  2991.                 3  =  <Up Arr> pressed, move to previous field 
  2992.                 4  =  <Dn Arr> pressed, move to next field
  2993.                 5  =  <Pg Up>  pressed, move to top of screen
  2994.                 6  =  <Pg Dn>  pressed, move to end of screen
  2995.                 7  =  A hotkey was supplied and used. The calling
  2996.                                program takes appropriate action.
  2997.  
  2998.                 You can specify any key as the hotkey by setting your
  2999.                 own value in HotKey% before calling REVINPUT. This
  3000.                 number can either be the ASCII code of any standard
  3001.                 key or the SCAN code (as a negative value) of one of
  3002.                 the function keys. Set HotKey% to zero to turn off
  3003.                 keyboard trapping (except for keys 1-6 above).            
  3004.  
  3005. Editing Keys:   <L.Arrow>   =  Move cursor one character to the left
  3006.                 <R.Arrow>   =  Move cursor one character to the right
  3007.                 <Home>      =  Move cursor to first character of field
  3008.                 <End>       =  Move cursor to last character of field
  3009.                 <Ctrl End>  =  Clear from current cursor position to
  3010.                                the end of the entry field.
  3011.                 <Insert>    =  Toggle between Insert and Overtype modes
  3012.                 <Delete>    =  Delete character under the cursor.
  3013.                 <BackSpace> =  Replace character under cursor with a
  3014.                                blank space and move cursor one character
  3015.                                to the left.
  3016.                 <F1>        =  pop up on-line HELP screen.
  3017.  
  3018. REVINPUT is designed to be used as part of a full-screen data-entry
  3019. system. Your program can examine the return code to determine whether the
  3020. operator wishes to terminate entry or move forwards or backwards between
  3021. entry fields.
  3022.  
  3023. See also the DATEINPUT function for a keyboard routine specially designed
  3024. to ask the operator for a date!!!!
  3025.  
  3026.  
  3027. ROOTNAME
  3028.  
  3029. Extracts the root filename from a full directory pathname.
  3030.  
  3031. DECLARE FUNCTION RootName$ (Path$, Extension%)
  3032.  
  3033. Path$       the full directory pathname of the file in question. This
  3034.             string can include the drive letter followed by a colon.
  3035.  
  3036. Extension%  If TRUE (non-zero) the returned filename will include the
  3037.             filename extension (if any). If FALSE (zero) the extension
  3038.             part is trimmed off.
  3039.  
  3040.  
  3041. ROUND
  3042.  
  3043. Rounds a double-precision number to the number of decimal places required
  3044. and returns it as a string.
  3045.  
  3046. DECLARE FUNCTION Round$ (Number#, Places%)
  3047.  
  3048.  
  3049. SALUTE
  3050.  
  3051. DECLARE FUNCTION Salute$ (Original$)
  3052.  
  3053. This function strips all but the first and last words from a string
  3054. and capitalises the first letter of each remaining word. This produces
  3055. a string suitable for use as the salutation of a letter.
  3056.  
  3057.  
  3058. SCREENDUMP
  3059.  
  3060. Copies the contents of the current screen (text mode only) to the line
  3061. printer, just as if the operator had pressed the <Prt Scrn> key.
  3062.  
  3063. No calling parameters are required.
  3064.  
  3065. DECLARE SUB ScreenDump ()
  3066.  
  3067. Includes support for 43 and 50-line screens on EGA and VGA adaptors.
  3068.  
  3069. This routine will not work if screen print has previously been disabled by
  3070. a call to the DISABLEPRTSC routine (see above) or if the parallel printer
  3071. at LPT1: is not ready.
  3072.  
  3073.  
  3074. SCREENMODE
  3075.  
  3076. This function calls ROM-BIOS to check the current video mode and then
  3077. converts the returned value to the equivalent QuickBASIC SCREEN number.
  3078. It can detect the Hercules 720 x 348 graphics mode (SCREEN 3) and the new
  3079. Olivetti 640 x 400 mode (SCREEN 4) as well as the Tandy 1000 and PCjr CGA
  3080. modes (SCREENs 5 & 6) which are not supported by QuickBASIC.  Other
  3081. unsupported graphics modes return a value of -1.
  3082.  
  3083. No calling parameters are required.
  3084.  
  3085. DECLARE FUNCTION ScreenMode% ()
  3086.  
  3087.  
  3088. SCREENROWS
  3089.  
  3090. Returns the height of the current screen, in rows, as set by the last
  3091. WIDTH statement (default = 25).
  3092.  
  3093. No calling parameters are required.
  3094.  
  3095. DECLARE FUNCTION ScreenRows% ()
  3096.  
  3097. The number returned may be 25, 43 or 50, depending on the capabilities of
  3098. your display adaptor.
  3099.  
  3100.  
  3101. SCREENWIDTH
  3102.  
  3103. Returns the width of the current screen, in columns, as set by the last
  3104. WIDTH statement.
  3105.  
  3106. No calling parameters are required.
  3107.  
  3108. DECLARE FUNCTION ScreenWidth% ()
  3109.  
  3110. Possible return values are 40 and 80 (default = 80).
  3111.  
  3112.  
  3113. SCRLOCK
  3114.  
  3115. Toggles SCROLL LOCK on or off or, alternatively, reads the current SCROLL
  3116. LOCK key setting.
  3117.  
  3118. DECLARE FUNCTION ScrLock% (BYVAL Switch%)
  3119.  
  3120. Switch% = 0  Turns SCROLL LOCK off
  3121.         = 1  Turns SCROLL LOCK on
  3122.  
  3123. Any other value just returns the current SCROLL status as a logical value
  3124. where -1 (TRUE) means that SCROLL LOCK is on and 0 (FALSE) means that the
  3125. SCROLL LOCK is off.
  3126.  
  3127.  
  3128. SCROLL
  3129.  
  3130. Scrolls the contents of a screen rectangle a specified number of lines or
  3131. columns in the direction indicated, blank spaces of the background colour
  3132. specified are scrolled in to replace them.
  3133.  
  3134. DECLARE SUB Scroll (BYVAL Dir%, BYVAL Y1%, BYVAL X1%, BYVAL Y2%,_
  3135.                     BYVAL X2%, BYVAL Units%, BYVAL Attr%)
  3136.  
  3137. Dir%        =  Scroll direction (0 = down, 1 = up, 2 = left, 3 = right).
  3138. Y1%         =  Top-left row of rectangle to be scrolled.
  3139. X1%         =  Top-left column of rectangle.
  3140. Y2%         =  Bottom-right row of rectangle.
  3141. X2%         =  Bottom-right column of rectangle
  3142. Units%      =  Number of rows or columns to scroll.
  3143. Attr%       =  Display attribute of blank spaces scrolled in.
  3144.  
  3145. Notes:      This routine will work in all graphics modes as well as on
  3146.             the text screen. When scrolling the graphics screen up or
  3147.             down, however, the attribute value must be calculated in a
  3148.             different way:
  3149.  
  3150.             On 320 x 200 4-colour and 640 x 200 2-colour displays the
  3151.             attribute represents a 1-byte pixel pattern, which is
  3152.             equivalent to 8 pixels in 2-colour (SCREEN 2) mode and 4
  3153.             pixels in 4-colour (SCREEN 1) mode. This pixel pattern is
  3154.             replicated through all the blank lines scrolled in.
  3155.  
  3156.             In all other EGA, VGA and MCGA display modes, ATTR% is
  3157.             the colour value for each pixel in the blanked lines.
  3158.  
  3159.             Scrolling sideways in graphics modes, using this routine,
  3160.             does not provide sufficiently fine movement for animation
  3161.             effects, but see the CGASCROLL and MCGASCROLL procedures
  3162.             (above) for a more precise alternative.
  3163.  
  3164.  
  3165. SECURE
  3166.  
  3167. Toggles bit zero of the specified file's directory entry, making it either
  3168. Read-only or Read/Write.
  3169.  
  3170. DECLARE SUB Secure (BYVAL Switch%, FileSpec$)
  3171.  
  3172. If SWITCH% = 1 the file is made Read-only (regardless of whether it can be
  3173. currently written to or not), any other value makes the file Read/Write.
  3174. FILESPEC is the name of the file to be hidden or unhidden. It can include
  3175. a drive letter and directory path but must be an explicit pathname,
  3176. wildcard characters are not allowed.
  3177.  
  3178.  
  3179. SERIALPORTS
  3180.  
  3181. This function checks how many serial ports are available, it does not
  3182. check to see if devices are connected to any of them.
  3183.  
  3184. No calling parameters are required.
  3185.  
  3186. DECLARE FUNCTION SerialPorts% ()
  3187.  
  3188.  
  3189. SETFLAG
  3190.  
  3191. This routine is used to set  one of the sixteen system flags to a value of
  3192. between 0 and 255. These flags are situated in the Intra-Application
  3193. Communications area, an area reserved by DOS for user programs to signal
  3194. to each other. FLAG% is the flag number (1-16), VALUE% is the value you
  3195. want to set.
  3196.  
  3197. DECLARE SUB SetFlag (Flag%, Setting%)
  3198.  
  3199. You can read the current setting of a particular IAC flag byte with the
  3200. GETFLAG function.
  3201.  
  3202.  
  3203. SHARE
  3204.  
  3205. Toggles bit seven of the specified file's directory entry, making it
  3206. either Shareable or Non-shareable. This routine will only work when the
  3207. program which calls it is running under a Novell Network.
  3208.  
  3209. DECLARE SUB Share (BYVAL Switch%, FileSpec$)
  3210.  
  3211. If SWITCH% = 1 the file is made Shareable (regardless of whether it can be
  3212. currently used by other programs or not), any other value makes the file
  3213. Non-shareable. FILESPEC is the name of the file to be shared. It can
  3214. include a drive letter and directory path but must be an explicit
  3215. pathname, wildcard characters are not allowed.
  3216.  
  3217.  
  3218. SHARING
  3219.  
  3220. Reports if SHARE.EXE, the MS-DOS file sharing support module, is installed
  3221. in memory. No calling parameters are required.
  3222.  
  3223. DECLARE FUNCTION Sharing% ()
  3224.  
  3225. If SHARE is installed the function returns a value of -1 (logical TRUE),
  3226. otherwise zero (logical FALSE) is returned.
  3227.  
  3228. Note:   for some reason this function does not return reliable results
  3229.         when called in the QuickBASIC environment, although it works
  3230.         fine in stand-alone programs. Does QB[X] disable SHARE then?
  3231.         
  3232. The NETTEST function (above) returns similar information for file sharing
  3233. under a Novell Network.
  3234.  
  3235.  
  3236. SHUTUP
  3237.  
  3238. Closes the last window opened by the POPUP window procedure (see above)
  3239. and restores the contents of the screen below it.
  3240.  
  3241. DECLARE SUB ShutUp (BYVAL Speed%)
  3242.  
  3243. The Speed% parameter is a delay in milliseconds. If greater than zero
  3244. it produces the effect of imploding the storage buffer contents onto the
  3245. screen, making the window appear to vanish into a point source.
  3246.  
  3247.  
  3248. SORTFILE
  3249.  
  3250. expects the user to supply the name of the file to be sorted. The file,
  3251. itself, must be fixed length and its name can include a drive letter and
  3252. directory pathname. The logical record length of the file must also be
  3253. supplied, along with the start position and length of the field which the
  3254. file is to be sorted on.
  3255.  
  3256. The procedure returns with Done% set to -1 (logical TRUE), if the sort
  3257. completed successfully, or to zero (logical FALSE) if an error occurred.
  3258.  
  3259. DECLARE SUB SortFile (PathName$, OffSet%, FieldLen%, RecordLen%, Done%)
  3260.  
  3261. The program first checks the size of the file and the amount of free disk
  3262. space to see if the it can be sorted in memory, this requires space for
  3263. two copies of the file on disk. If it is too large, the file is sorted in
  3264. place so that no extra disk space is required. Using this method, which is
  3265. far slower, the file may be of any size up to 4 Gigabytes.
  3266.  
  3267. Note:       If, when sorting in place on disk, SORTFILE detects that there
  3268.             is a Ramdisk installed with enough free space to hold the file
  3269.             that is being sorted, the program will copy and sort the file
  3270.             there. This is much faster than a conventional disk sort, but
  3271.             still not as fast as sorting directly in memory.
  3272.  
  3273. Programs calling this routine must have at least two unused file buffers
  3274. available (i.e. no more than thirteen files must be already open).
  3275.  
  3276.  
  3277. SOUNDEX
  3278.  
  3279. Gets the phonetic equivalent of a string. This function returns a long
  3280. integer which represents the 'sound' of a string of text using the SOUNDEX
  3281. phonetic conversion algorithm. It can be used in 'fuzzy' searches, for
  3282. example, to scan a database for an individual when you are not sure of the
  3283. exact spelling of their surname. When searching for SMITH, for instance,
  3284. SOUNDEX would also match SMYTH and SMYTHE.
  3285.  
  3286. DECLARE FUNCTION Soundex& (Text$)
  3287.  
  3288. Note that the initial letter of the search string must exactly match the
  3289. initial letter of the target. GAMMELL and CAMMEL will return different
  3290. values when passed to SOUNDEX. Note also that the function will only
  3291. convert the first word of the string, translation stops at the first
  3292. blank space.
  3293.  
  3294.  
  3295. SPLITNAME
  3296.  
  3297. Parses a string containing the full or postal name of a person and
  3298. extracts the TITLE, INITIALS and SURNAME from it.
  3299.  
  3300. DECLARE SUB SplitName (Source$, Title$, Initial$, SurName$)
  3301.  
  3302. Most commonly used titles (eg MR, MRS, MISS, MS) are correctly
  3303. identified and seperated out.
  3304.  
  3305.  
  3306. SPOOLER
  3307.  
  3308. Gets the installed state of the DOS print spooler, PRINT.COM, so that a
  3309. program can check if it is safe to submit files to the print queue.
  3310.  
  3311. No calling parameters are required.
  3312.  
  3313. DECLARE FUNCTION Spooler% ()
  3314.  
  3315. Returns:    -1  if spooler is installed
  3316.              0  if spooler is not installed
  3317.  
  3318.  
  3319. SPOOLDELETE
  3320.  
  3321. Deletes one or more files from the current print queue.
  3322.  
  3323. FileSpec$ should include the full pathname of the file to be deleted from
  3324. the print queue. It can be ambiguous, using the DOS wildcard characters
  3325. '*' and '?', allowing you to cancel the processing of a range of files
  3326. with a single command.
  3327.  
  3328. DECLARE SUB SpoolDelete (FileSpec$)
  3329.  
  3330. Note:       This function will only work if PRINT.COM, the DOS print
  3331.             spooler has been installed. You can use the SPOOLER
  3332.             function (see above) to check if PRINT.COM is available.
  3333.  
  3334.  
  3335. SPOOLFLUSH
  3336.  
  3337. Deletes all files from the current print queue and terminates output to
  3338. the printer.
  3339.  
  3340. No calling parameters are required.
  3341.  
  3342. DECLARE SUB SpoolFlush ()
  3343.  
  3344. Note:       This function will only work if PRINT.COM, the DOS print
  3345.             spooler has been installed. You can use the SPOOLER
  3346.             function (see above) to check if PRINT.COM is available.
  3347.  
  3348.  
  3349. SPOOLLIST
  3350.  
  3351. Returns the pathname of a file in the current print queue.
  3352.  
  3353. SPOOLLIST can only be used while printing is suspended after a call to the
  3354. SPOOLSUSPEND function (see below) has been made.
  3355.  
  3356. Buffer$ must be preset to a length of at least 64 bytes for the routine to
  3357. work, although you do not have to fill it with spaces first.  When called,
  3358. immediately after printing has been suspended, SPOOLLIST will return, in
  3359. Buffer$, the pathname of the first file in the spooler print queue.
  3360.  
  3361. Further calls will return the names of subsequent files in the queue until
  3362. a string of blank spaces indicates that all entries have been read.
  3363.  
  3364. DECLARE SUB SpoolList (Buffer$)
  3365.  
  3366. The following example demonstrates how SPOOLLIST, SPOOLSUSPEND and
  3367. SPOOLRESTART can be used in a QuickBASIC program.
  3368.  
  3369.     CONST FALSE = 0, TRUE = NOT FALSE
  3370.  
  3371.     Buffer$ = STRING$(64, "*")
  3372.  
  3373.     Status% = SpoolSuspend%
  3374.     PRINT "Spooler suspended, status is"; Status%
  3375.     PRINT "Files in print queue are ...": PRINT
  3376.     Done% = FALSE: Number% = 1
  3377.     DO
  3378.         SpoolList Buffer$
  3379.         IF Buffer$ = SPACE$(64) THEN
  3380.            Done% = TRUE
  3381.         ELSE
  3382.            PRINT Number%, Buffer$
  3383.            Number% = Number% + 1
  3384.        END IF
  3385.     LOOP UNTIL Done%
  3386.     CALL SpoolReStart
  3387. END
  3388.  
  3389. Use SPOOLRESTART (see below) to resume printing after it has been
  3390. suspended for a listing of the queue contents to be made.
  3391.  
  3392. Note:       This function will only work if PRINT.COM, the DOS print
  3393.             spooler has been installed. You can use the SPOOLER
  3394.             function (see above) to check if PRINT.COM is available.
  3395.  
  3396.  
  3397. SPOOLRESTART
  3398.  
  3399. Re-enables output of spooled files to the printer after it has been
  3400. suspended for a status check or for the queue contents to be listed.
  3401.  
  3402. No calling parameters are required.
  3403.  
  3404. DECLARE SUB SpoolReStart ()
  3405.  
  3406. Note:       This function will only work if PRINT.COM, the DOS print
  3407.             spooler has been installed. You can use the SPOOLER
  3408.             function (see above) to check if PRINT.COM is available.
  3409.  
  3410.  
  3411. SPOOLSUBMIT
  3412.  
  3413. Submits a file for processing by the DOS print spooler. 
  3414.  
  3415. FileSpec$ should contain the full pathname of the file to be printed and
  3416. should be no longer than 64 characters. Wildcard characters are not
  3417. allowed. If found, the file will be added to the end of the current print
  3418. queue.
  3419.  
  3420. DECLARE SUB SpoolSubmit (FileSpec$)
  3421.  
  3422. Note:       This function will only work if PRINT.COM, the DOS print
  3423.             spooler has been installed. You can use the SPOOLER
  3424.             function (see above) to check if PRINT.COM is available.
  3425.  
  3426.  
  3427. SPOOLSUSPEND
  3428.  
  3429. Suspends output from the DOS print spooler and reports if an error has
  3430. been encountered. Printing is suspended until you use the SPOOLRESTART
  3431. procedure (see above) to resume output. 
  3432.  
  3433. No calling parameters are required.
  3434.  
  3435. DECLARE FUNCTION SpoolSuspend% ()
  3436.  
  3437. Returns:     0 = no errors
  3438.              1 = invalid function
  3439.              2 = file not found
  3440.              3 = path not found
  3441.              4 = too many open files
  3442.              5 = access denied
  3443.              8 = queue full
  3444.              9 = spooler busy
  3445.             12 = name too long
  3446.             15 = invalid drive    
  3447.  
  3448. SPOOLLIST (see above), which returns the pathnames of files in the print
  3449. queue, can only be called while the spooler is suspended.
  3450.  
  3451. Note:       This function will only work if PRINT.COM, the DOS print
  3452.             spooler has been installed. You can use the SPOOLER
  3453.             function (see above) to check if PRINT.COM is available.
  3454.  
  3455.  
  3456. STATUSLINE
  3457.  
  3458. This procedure displays the message supplied on the bottom line of the
  3459. display, prompts the user for a keypress, waits until it is received and
  3460. then returns, restoring the screen to its former state. The  ASCII value
  3461. of the keypress is returned in the variable that you assign to the
  3462. function.
  3463.  
  3464. DECLARE FUNCTION StatusLine% (Message$)
  3465.  
  3466. Note:       StatusLine will recognise if an EGA or VGA is installed and
  3467.             will correctly locate itself if the screen is in 43 or 50-
  3468.             line mode.
  3469.  
  3470.  
  3471. STRINGSCAN
  3472.  
  3473. This routine searches a variable-length string array for the string
  3474. specified, returning the element number it occupies if found.
  3475.  
  3476. DECLARE FUNCTION StringScan% (Trgt$, BYVAL Size%, BYVAL Strt%, BYVAL Addr%)
  3477.  
  3478. Arguments:  Trgt$ = target string to be searched for.
  3479.             Size% = number of array elements to be searched.
  3480.             Strt% = array element to start searching at.
  3481.             Addr% = address of start element (the VARPTR value).  
  3482.                      
  3483. See also the STRINGSORT routine (below) for a fast method of sorting a
  3484. variable-length string array.
  3485.  
  3486.  
  3487. STRINGSORT
  3488.  
  3489. This procedure can sort a string array into ascending or descending order,
  3490. very quickly indeed.
  3491.  
  3492. DECLARE SUB StringSort (BYVAL Dir%, BYVAL Size%, BYVAL Addr%)
  3493.  
  3494. Arguments:  Dir%    = sort direction (0 = ascending, 1 = descending).
  3495.             Size%   = number of elements to sort.
  3496.             Addr%   = VARPTR of element to start sorting from.
  3497.  
  3498. Note:       This routine now works perfectly with Extended QuickBASIC
  3499.             far string arrays, provided that the range of elements to
  3500.             sort are contained within a single 64K segment. If the
  3501.             array extends over more than one segment then no sorting
  3502.             will be performed at all.
  3503.  
  3504. For an example of fast string sorting and searching, see the source code
  3505. for DEMON, the Toolbox demonstration program.
  3506.  
  3507.  
  3508. STRIPQUOTES
  3509.  
  3510. Strips quotation marks and commas from a string which is to be
  3511. written to a comma-delimited ASCII file.
  3512.  
  3513. DECLARE FUNCTION StripQuote$ (Source$)
  3514.  
  3515. All double quote characters (") found in SOURCE$ are replaced
  3516. with single quotes (') and all commas replaced by blank spaces.
  3517. The length of the string is unchanged.
  3518.  
  3519.  
  3520. STUFFBUFFER
  3521.  
  3522. Stuffs a string of up to fifteen keystrokes into the keyboard typeahead
  3523. buffer. These keystrokes will then be read by subsequent INPUT or INKEY
  3524. statements or passed to DOS when the program ends.
  3525.  
  3526. DECLARE SUB StuffBuffer (Buffer$)
  3527.  
  3528. Buffer$ is the string of ASCII characters to be placed in the keyboard
  3529. buffer. A maximum of fifteen characters may be used, any extra ones will
  3530. be ignored. 
  3531.  
  3532. If the string is a command to be executed by DOS when your program
  3533. terminates, it should include a trailing carriage-return. For example,
  3534. the following command will clear the screen and display a directory
  3535. listing:
  3536.  
  3537. StuffBuffer "CLS" + CHR$(13) + "DIR" + CHR$(13)
  3538.  
  3539. Any previously unread keystrokes will be flushed from the buffer by 
  3540. this routine.
  3541.  
  3542.  
  3543. TEMPFILE
  3544.  
  3545. Creates a temporary file with a user-specified attribute
  3546.  
  3547. DECLARE FUNCTION TempFile$ (BYVAL FlAttr%)
  3548.  
  3549. Argument:   FileAttr%   the directory attribute to be given to the
  3550.                         temporary file. Possible values are:
  3551.                         
  3552.                     0   Normal
  3553.                     1   Read-only
  3554.                     2   Hidden
  3555.                     4   System
  3556.  
  3557. The temporary file is created, with the attribute you specify and a
  3558. unique filename, in the current directory and its' full pathname
  3559. (excluding drive letter) is returned by the function. Your program is
  3560. responsible for opening it and all subsequent processing. It will not
  3561. be automatically deleted when the program ends.
  3562.  
  3563.  
  3564. ULPRINT
  3565.  
  3566. Sends the text supplied, to the printer, as a string of underlined
  3567. characters.  Output begins at the current print position and can,
  3568. optionally, append a carriage-return/linefeed to take the print head to
  3569. the beginning of a new line when finished.
  3570.  
  3571. DECLARE SUB UlPrint (BYVAL Printer%, Buffer$, BYVAL NewLine%)
  3572.  
  3573. Arguments:  Printer%    the parallel port output is to be sent to
  3574.                         (1 = LPT1:, 2 = LPT2:, etc.).
  3575.             Buffer$     the string of text to be printed.
  3576.             NewLine%    set this to a non-zero value if you want 
  3577.                         to move to a new line after printing.
  3578.  
  3579. The routine restores the previous print style or font before it returns
  3580. and does not effect subsequent output to the printer, using the QuickBASIC
  3581. LPRINT or PRINT # statements.
  3582.  
  3583. Note:       The version of this routine stored in the Toolbox
  3584.             library is for EPSON compatible printers. If you have
  3585.             an IBM graphics printer or ProPrinter, then you should
  3586.             rebuild your libraries, using either the PRINTIBM.OBJ
  3587.             or PRINTPRO.OBJ object module in place of PRINTEPS.OBJ.
  3588.  
  3589.  
  3590. UNPAD
  3591.  
  3592. Removes multiple spaces from a string, making sure that no word
  3593. in a string of text has more than one blank space between it.
  3594.  
  3595. DECLARE FUNCTION UnPad$ (Text$, Length%)
  3596.  
  3597. Text$       the string of text to be processed.
  3598.  
  3599. Length%     on return, holds the length of the string after
  3600.             processing.
  3601.  
  3602. Leading and trailing spaces are also trimmed.
  3603.  
  3604.  
  3605. VERIFY
  3606.  
  3607. This function opens a dialogue box, centered at the screen row specified,
  3608. in which is displayed a prompt supplied by the caller. The routine adds a
  3609. further Y/N prompt, and then waits for a keypress. Only <Y/N> responses
  3610. (in upper or lower case) are accepted and the value that is returned
  3611. evaluates to Boolean TRUE (-1), if a Y(es) response was entered, and
  3612. Boolean FALSE (0) if the reply was N(o). The screen is restored to its
  3613. previous state on exit from the function.
  3614.  
  3615. DECLARE FUNCTION Verify% (BYVAL Default%, BYVAL Row%, Prompt$,_
  3616.                           BYVAL Attr%, BYVAL Mouse%)
  3617.  
  3618. DEFAULT%    Specifies the radio button to be highlighted as the default
  3619.             response on entry into the function. Pressing <Return> or
  3620.             clicking the left mouse button without moving the pointer
  3621.             will produce the specified response. If DEFAULT% is set to
  3622.             one the YES button is highlighted. Any other value highlights
  3623.             the NO button. 
  3624.  
  3625. ROW%        The top row of the dialogue box when it is displayed. The
  3626.             box is automatically centered within this row, which may be
  3627.             adjusted so that it remains within the screen boundaries.
  3628.  
  3629. PROMPT$     A string of text comprising the message to be displayed. It
  3630.             must be no longer than 40 characters otherwise it will be
  3631.             truncated to fit inside the display panel.
  3632.  
  3633. ATTR%       The display attribute or colour to be given to the dialogue box.
  3634.             If an argument of zero is supplied, the box is displayed with
  3635.             bright white text on a blue background (colour monitors) or in
  3636.             reverse video (monochrome monitors).
  3637.  
  3638. MOUSE%      should be set to TRUE (-1) or FALSE (0) to indicate if a mouse
  3639.             is installed and can be used to respond.    
  3640.  
  3641. Notes:      The user can respond, either by pressing the <Y> or <N> keys
  3642.             or by using <TAB> to highlight the appropriate radio button
  3643.             and then pressing <RETURN>. 
  3644.  
  3645. Mouse support has now been added, enabling the operator to respond by
  3646. clicking the mouse cursor on the appropriate radio button.
  3647.  
  3648.  
  3649. VERMENU
  3650.  
  3651. Displays and operates a pulldown menu, allowing the user to select from
  3652. the list of options displayed in the menu window. 
  3653.  
  3654. DECLARE SUB VerMenu (Row%, Col%, Attr%, Bdr%, Opts%, Title$, Menu$(),_
  3655.                      Choice%, Nxt%, Bar%, Ctx%, Tpc$, Mouse%, HotKeys%)
  3656.  
  3657. Expects:  Row%, Col%    screen co-ordinates of top-left corner of the
  3658.                         window containing the menu.
  3659.           Attr%         display attribute given to menu window.
  3660.           Bdr%          Border style (1 - 8, 0 = no border). see the
  3661.                         WINDOWS documentation for a list of styles.
  3662.           Opts%         Number of options provided by menu.
  3663.           Title$        Title for the menu, if null string then no
  3664.                         title is displayed.
  3665.           Menu$()       Text for options list. 
  3666.                         MENU$(0) should contain a list of Hotkey
  3667.                         characters, one for each option. Insert a space
  3668.                         at the appropriate position if an option is to
  3669.                         be disabled. A hash character '#' in Menu$(0)
  3670.                         will replace the option at that position with
  3671.                         a horizontal line seperator.
  3672.                         In the remaining option strings an ampersand '&'
  3673.                         indicates that the next character is the Hotkey
  3674.                         to be highlighted for that option. The Hotkey
  3675.                         character should be the same as the one in the
  3676.                         appropriate position of Menu$(0)
  3677.           Ctx%          If set, this indicates that context-sensitive
  3678.                         help is available, in which case ...
  3679.           Tpc$          The root name of the Topic file to be displayed
  3680.                         if the user presses <F1> for help. The current
  3681.                         menu number and selection number are appended to
  3682.                         this to produce the actual filename, eg where:
  3683.                         
  3684.                         Tpc$ = "CONFIG"     Bar% = 2    Choice% = 5
  3685.                         
  3686.                         HELPMATE (see TOOLBOX.DOC) looks for a Topic
  3687.                         file named CONFIG25.HLP.
  3688.  
  3689.                         (Note that Bar% is automatically set if you are
  3690.                         using this function in conjunction with BARMENU.
  3691.                         if not, Bar% defaults to zero and HELMATE expects
  3692.                         CONFIG05.HLP to be the appropriate TOPIC file.)
  3693.                         
  3694.           Mouse%        If set, this flag indicates that a mouse is
  3695.                         installed and can be used to make selections.
  3696.           HotKeys%      If set, this flag allows hotkeys to go directly
  3697.                         to a selection without the user having to press
  3698.                         <ENTER> as well.
  3699.  
  3700. Returns:  Choice%       Number of selection made by user. If zero then
  3701.                         the user pressed <ESC> to abort without making
  3702.                         a selection.
  3703.           Nxt%          Set TRUE if the user pressed the left or right
  3704.                         arrow key to move sideways to another menu, in
  3705.                         which case ....
  3706.           Bar%          is incremented or decremented accordingly.
  3707.  
  3708. The BARMENU procedure provides a similarly featured menu which is
  3709. orientated horizontally.
  3710.  
  3711. See the source code for DEMON.BAS, the Toolbox demonstration program, for
  3712. an example of VERMENU (and BARMENU) in use.
  3713.  
  3714.  
  3715. VGADIM
  3716.  
  3717. Allows a program running on a computer fitted with VGA to dim or brighten
  3718. the display intensity.
  3719.  
  3720. DECLARE SUB VGADim (BYVAL Intensity%)
  3721.  
  3722. Intensity% is a number in the range -63 to +63 which sets the brightness
  3723. of the screen relative to the default value (zero).
  3724.  
  3725.  
  3726. VGALOAD
  3727.  
  3728. Loads EGA, VGA and MCGA screens into video memory from disk. This is an
  3729. alternative to the QuickBASIC BLOAD statement which cannot be used with
  3730. the higher-resolution graphics displays provided by SCREEN modes 7 to 13.
  3731.  
  3732. DECLARE SUB VGALoad (File$)
  3733.  
  3734. FILE$ must be a legal DOS filename, including extension, drive letter and
  3735. directory path where appropriate.
  3736.  
  3737. Note:       The screen image must have been previously written to a disk
  3738.             file using the VGASAVE procedure (see below) and should have
  3739.             the same resolution as that provided by the current SCREEN.
  3740.  
  3741.  
  3742. VGAPAN
  3743.  
  3744. Sets the display window co-ordinates for EGA, VGA and MCGA screens.
  3745.  
  3746. This procedure sets the origins of display window within the video display
  3747. buffer used by the EGA, VGA and MCGA adaptors.  Normally this is at the
  3748. top left-hand corner of the graphics image, but by changing co-ordinates
  3749. you can pan the display through video memory, to create some interesting
  3750. animation effects.
  3751.  
  3752. DECLARE SUB VGAPan (BYVAL X%, BYVAL Y%)
  3753.  
  3754. See the source code to DEMON, the Toolbox demonstration program for an
  3755. example using VGAPAN.
  3756.  
  3757.  
  3758. VGASAVE
  3759.  
  3760. Saves EGA, VGA and MCGA screens from video memory to disk. 
  3761.  
  3762. The normal QuickBASIC BLOAD and BSAVE statements only work properly with
  3763. text and CGA graphics screens. This routine allows you to do the same
  3764. with higher-resolution graphic displays in SCREEN modes 7 to 13.
  3765.  
  3766. DECLARE SUB VGASave (File$)
  3767.  
  3768. FILE$ must be a legal DOS filename, including the extension, drive letter
  3769. and directory path where appropriate.
  3770.  
  3771. A companion procedure, VGALOAD (see above) is provided to allow you to
  3772. retrieve the graphics image from disk, and restore it to the screen.
  3773.  
  3774. See the source code to DEMON, the Toolbox demonstration program for an
  3775. example using VGALOAD and VGASAVE.
  3776.  
  3777.  
  3778. VGATEXT
  3779.  
  3780. Writes characters to the screen in EGA and VGA graphics modes.
  3781.  
  3782. DECLARE SUB VgaText (BYVAL xLoc%, BYVAL yLoc%, Text$,_
  3783.                      BYVAL Attr%, BYVAL Scale%)
  3784.  
  3785. This routine provides a convenient way of displaying text in any of the
  3786. EGA and VGA graphics modes (SCREENs 7-12) without having to bother about
  3787. loading external font files. It uses the standard character definition
  3788. tables built into your display adaptor, but allows you to scale them up to
  3789. eight times normal size and to specify any combination of foreground and
  3790. background colours supported by the current video mode.
  3791.  
  3792. XLOC%       The horizontal co-ordinate of the top left hand pixel
  3793.             from which the text will begin
  3794.  
  3795. YLOC%       The vertical co-ordinate of the top left hand pixel
  3796.             from which the text will begin
  3797.  
  3798. TEXT$       The string of text to be displayed (up to 63 characters).
  3799.  
  3800. ATTR%       The colour (or display attribute in monochrome modes) to
  3801.             be given to the text. This is calculated by the formula:
  3802.  
  3803.             Colour% = (Background% * 256) + Foreground%
  3804.  
  3805.             Foreground and Background values are in the ranges used
  3806.             by the current video mode (eg. 0 - 15 for SCREEN 9). The
  3807.             actual colours displayed depend upon your current PALETTE
  3808.             settings.
  3809.  
  3810.             Note:   supplying a value of -1 for background prevents
  3811.                     background pixels from being changed at all. This
  3812.                     allows text to be blended more naturally into a
  3813.                     complex graphics display.
  3814.  
  3815. SCALE%      The character size of the text to be displayed. This ranges
  3816.             from 1 to 8, where 1 is standard 80-column text (40-column
  3817.             in SCREEN 7) and 8 multiplies the character size by eight
  3818.             on both the horizontal and vertical axes.
  3819.  
  3820. VGATEXT can handle both byte-aligned and non byte-aligned characters. The
  3821. x, y co-ordinates you supply do not need to correspond to a row, column
  3822. character cell in SCREEN 0, the alphanumeric mode. The complete extended
  3823. ASCII character set is supported, including foreign symbols and
  3824. box-drawing characters.
  3825.  
  3826. Since VGATEXT does not support clipping, to ensure a clean display you
  3827. must ensure that the text to be output fits within the current screen
  3828. boundaries.
  3829.  
  3830. See also CGATEXT for displaying characters in SCREEN 1 and MCGATEXT for
  3831. displaying characters in SCREEN 13.
  3832.  
  3833.  
  3834. VIDEOMODE
  3835.  
  3836. Checks the video system capabilities of the host computer.
  3837.  
  3838. DECLARE SUB VideoMode (Colour%, MaxRes%, VideoRam%)
  3839.  
  3840. This function calls ROM-BIOS to check the type of display adaptor which is
  3841. installed in the host system. Three variables are supplied which, on
  3842. return, provide the following information:
  3843.  
  3844. COLOUR%   -1 = Colour adaptor   Indicates the presence of a colour
  3845.            0 = Monochrome       monitor in EGA systems. Returns -1
  3846.                                 for CGA, even if a mono monitor is
  3847.                                 bring used.
  3848. MAXRES%    highest SCREEN       Highest resolution graphics screen
  3849.            resolution           which can be set. Is equivalent to
  3850.                                 QuickBASIC SCREEN numbers. MDA can
  3851.                                 only use SCREEN 0, CGA 0, 1 and 2
  3852.                                 N.B. MaxRes% = 10 indicates an EGA
  3853.                                 with mono monitor. This means that
  3854.                                 SCREEN 9 can NOT be used.
  3855. VIDEORAM%  in kilobytes         Amount of dedicated display memory
  3856.                                 installed. 
  3857.                                 MDA = 4K, CGA = 16K, EGA = 64-256K
  3858.  
  3859.  
  3860. WEEKDAY
  3861.  
  3862. This function is used to determine the day of the week for a given date.
  3863. It does this by temporarily resetting the system date to the one supplied,
  3864. reading the day from DOS, and then restoring the old date. The weekday is
  3865. returned as a number between 0 and 6, signifying Sunday through Saturday.
  3866.  
  3867. DECLARE FUNCTION WeekDay% (BYVAL Day%, BYVAL Month%, BYVAL Year%)
  3868.  
  3869. Note:   The year value should be supplied as a 4-digit number between
  3870.         1981 and 2099.
  3871.  
  3872. ──────────────────────────────────────────────────────────────────────
  3873.  
  3874. EXTRA ROUTINES FOR QB4
  3875.  
  3876. The following functions and procedures are only included in the version of
  3877. the Toolbox intended for QuickBASIC 4.x and BASIC 6. They are omitted from
  3878. the later version because the Extended QuickBASIC language provided with
  3879. the BASIC 7 Professional Development System includes new statements and
  3880. functions that render them unneccessary. Well they say that imitation IS
  3881. the sincerest form of flattery!
  3882.  
  3883.  
  3884. CHANGEDIR
  3885.  
  3886. This procedure changes the current directory to the one specified by the
  3887. pathname supplied. If a drive letter is included in the argument, the
  3888. routine also changes the current drive.
  3889.  
  3890. DECLARE SUB ChangeDir (PathName$)
  3891.  
  3892. Microsoft have now added CHDIR and CHDRIVE statements to QBX, the new
  3893. Extended QuickBASIC supplied with BASIC 7. Since these statements make
  3894. CHANGEDIR redundant, it is not provided with the BASIC 7 Toolbox.
  3895.  
  3896.  
  3897. FINDFIRST
  3898.  
  3899. This routine sets the Disk Transfer Address to point to a local buffer and
  3900. then attempts to find a match for the file specified in WildCard$. If one
  3901. or more matches are found, the filename of the first matching file (minus
  3902. directory path), is stuffed into the second string argument. If no match
  3903. is found, this string is filled with blank spaces.
  3904.  
  3905. DECLARE SUB FindFirst (Attr%, WildCard$, Match$)
  3906.  
  3907. WildCard$ can contain an ambiguous filename, using the wildcard characters
  3908. * and ?, in which case FINDFIRST will only find the first matching file.
  3909. To obtain the names of any subsequent matches, use the FINDNEXT function
  3910. (see below).
  3911.  
  3912. Match$ must be at least twelve characters long to hold the returning
  3913. filename and extension. You do not need to clear the string first as the
  3914. function does that for you, automatically.
  3915.  
  3916. Normally, only visible files with full read\write access are found, but
  3917. you can extend this to search for hidden, read-only or system files as
  3918. well by setting the Attr% parameter to the appropriate attribute value.
  3919.  
  3920.    Attr% = 0   Visible read\write
  3921.            1   Read-only files
  3922.            2   Hidden files
  3923.            4   System files
  3924.  
  3925. Do not use the FILESIZE function while searching for files with FINDFIRST
  3926. and FINDNEXT. Since both routines relocate the DOS Disk Transfer Address
  3927. during operation, this may lead to a conflict which will cause your
  3928. program to lose track of one or more open files. You should, in any case,
  3929. always use the RESETDTA routine to restore the Disk Transfer Address after
  3930. FINDFIRST/FINDNEXT is completed.
  3931.  
  3932. The DIR$ function which Microsoft have added to Extended QuickBASIC (QBX)
  3933. provides a built-in FINDFIRST/FINDNEXT service which makes the Toolbox
  3934. routines redundant. They are, therefore, omitted from the BASIC 7 version.
  3935.  
  3936.  
  3937. FINDNEXT
  3938.  
  3939. Finds successive matches of an ambiguous filename after a previously
  3940. successful call to FINDFIRST (see above). You can call it repeatedly
  3941. until a blank string is returned in Match$, in which case there are
  3942. no more files to be found.
  3943.  
  3944. DECLARE SUB FindNext (Match$)
  3945.  
  3946. Match$ must be at least twelve characters long to hold the returning
  3947. filename and extension. It does not have to be cleared first, since the
  3948. routine does this for you, automatically.
  3949.  
  3950. Do not make use the FILESIZE function while searching for files with
  3951. FINDFIRST and FINDNEXT. Since both routines relocate the DOS Disk Transfer
  3952. Address during operation, this may lead to a conflict which will cause
  3953. your program to lose track of one or more open files. You should, in any
  3954. case, always use the RESETDTA routine to restore the Disk Transfer Address
  3955. after FINDFIRST/FINDNEXT is completed.
  3956.  
  3957. The DIR$ function which Microsoft have added to Extended QuickBASIC (QBX)
  3958. provides a built-in FINDFIRST/FINDNEXT service which makes the Toolbox
  3959. routines redundant. They are, therefore, omitted from the BASIC 7 version.
  3960.  
  3961.  
  3962. GETDIR
  3963.  
  3964. This procedure writes the pathname of the currently logged directory into
  3965. the string supplied by the caller. The user can specify what drive to
  3966. return the directory for, or default to the current drive.
  3967.  
  3968. DECLARE SUB GetDir (Drive%, Path$)
  3969.  
  3970. This routine expects two arguments to be passed to it. The first is an
  3971. integer which specifies the drive to look at :
  3972.  
  3973. 0 = default drive, 1 = drive A:, 2 = drive B:, etc.
  3974.  
  3975. the second argument is a string which will hold the path of the directory
  3976. returned by DOS. The string must be at least 64 bytes long to hold the
  3977. information. If it were not, the function might overwrite other variables
  3978. in the program data space, with unpredictable results. The returned path-
  3979. name does not include the drive identifier or a leading '\' and is
  3980. terminated by a null (0) byte. if the current directory is the root
  3981. directory, therefore, the first byte of the string will be an ASCII zero,
  3982. not a null string.
  3983.  
  3984. The CURDIR$ function which Microsoft have added to Extended QuickBASIC
  3985. (QBX) allows you to obtain the current directory path and drive, making
  3986. GETDIR redundant. It is, therefore, omitted from the BASIC 7 version of
  3987. the Assembly Language Toolbox.
  3988.  
  3989.  
  3990. GETDRIVE
  3991.  
  3992. This function returns the number of the currently-logged drive.
  3993.  
  3994. No calling parameters are required.
  3995.  
  3996. DECLARE FUNCTION GetDrive% ()
  3997.  
  3998. Values returned are in the series 0 = A:, 1 = B:, 2 = C:, etc.
  3999.  
  4000. The CURDIR$ function which Microsoft have added to Extended QuickBASIC
  4001. (QBX) allows you to obtain the current directory path and drive, making
  4002. GETDRIVE redundant. It is, therefore, omitted from the BASIC 7 version of
  4003. the Assembly Language Toolbox.
  4004.  
  4005.  
  4006. RESETDTA
  4007.  
  4008. This procedure must always be called by your program after the FINDFIRST
  4009. and FINDNEXT functions have been used. It restores the Disk Transfer
  4010. Address to its default value originally set by QuickBASIC.
  4011.  
  4012. No calling parameters are required.
  4013.  
  4014. DECLARE SUB ReSetDTA ()
  4015.  
  4016.  
  4017. SETDRIVE
  4018.  
  4019. This function changes the currently-logged drive to the one specified by
  4020. the calling program (0 = A:, 1 = B:, etc.).
  4021.  
  4022. DECLARE SUB SetDrive (Drive%)
  4023.  
  4024. Since BASIC 7 has now introduced the CHDRIVE statement which performs the
  4025. same task, SETDRIVE is only supported in the version of the Toolbox
  4026. supplied to QuickBASIC 4 users.
  4027.  
  4028. WAITASEC
  4029.  
  4030. System-independent pause for a specified number of seconds. The delay will
  4031. still be the same, whether you have an original IBM-PC or an AT with the
  4032. latest Intel i486 processor running at 66MHz.
  4033.  
  4034. DECLARE SUB WaitaSec (Seconds!)
  4035.  
  4036. This is an alternative to the SLEEP statement, for people who still use
  4037. QuickBASIC 4.0
  4038.  
  4039. ──────────────────────────────────────────────────────────────────────
  4040.  
  4041. ASSEMBLY-LANGUAGE TOOLBOX INTERNAL FUNCTIONS
  4042.  
  4043. The following functions and procedures are used internally by Toolbox
  4044. routines. Assembly-Language programmers may also call them when adding
  4045. routines of their own, provided the appropriate object modules are linked
  4046. to their program at runtime.
  4047.  
  4048.  
  4049. FLAGS
  4050.  
  4051. Sets or gets the current status of individual flags in the Intra-
  4052. Application Communications area (IAC), a 16-byte block of RAM reserved, by
  4053. DOS, for signalling between applications programs.
  4054.  
  4055. Three parameters must be passed on the stack, they are:
  4056.  
  4057.         1)  Switch%     0 = get flag,   1 = set flag
  4058.         2)  Flag%       the offset into the IAC flag table (0 to 15)
  4059.         3)  Setting%    the value to be set into the specified byte
  4060.                         of the flag table (if Switch% = 1).
  4061.  
  4062. This example code fragment sets letter 'A' (ASCII 65) into flag 8 (byte 9)
  4063. of the IAC area.
  4064.  
  4065.             .model  medium              ; Required for QuickBASIC
  4066.  
  4067.             extrn   Flags: far          ; Public name of called routine
  4068.  
  4069.             .code                       ; Define code segment
  4070.  
  4071.             mov     ax,1                ; Set a flag byte
  4072.             push    ax                  ; Pass it on the stack
  4073.             mov     ax,8                ; Flag number 8
  4074.             push    ax                  ; Pass it on the stack
  4075.             mov     ax,'A'              ; Value to set
  4076.             push    ax                  ; Pass it on the stack
  4077.             call    Flags               ; Call the function
  4078.  
  4079. You must still push three parameters onto the stack even if you are only
  4080. reading a flag setting. In this case the third argument will be ignored.
  4081.  
  4082. The setting of the specified IAC flag is returned in the lower byte of the
  4083. AX register (AL). All other registers are preserved.
  4084.  
  4085.  
  4086. GETVERSION
  4087.  
  4088. This function checks the version of DOS under which the host computer is
  4089. currently running.
  4090.  
  4091.             extrn   GetVersion: far
  4092.  
  4093. The following register values may be returned:
  4094.  
  4095.     AL      = Major Version       (MS-DOS 3.2 = 3, etc.)
  4096.     AH      = Minor Version       (MS-DOS 3.2 = 20, etc.) 
  4097.                             
  4098. GETVERSION can be called directly from QuickBASIC, in which case only the
  4099. Major and Minor version numbers returned in AX are available.
  4100.  
  4101. Note:   This function returns the correct version number even under
  4102.         DOS 5.x with SETVER configured to return a different number.
  4103.  
  4104.  
  4105. HIDECURSOR
  4106.  
  4107. Makes the cursor invisible. No parameters are required or returned.
  4108.  
  4109.             extrn   HideCursor: far
  4110.  
  4111. This method ORs the byte value of the cursor start line with 32 (20 Hex)
  4112. which, on all standard video adaptors, turns off the cursor while
  4113. preserving its display characteristics. You can use the SHOWCURSOR
  4114. routine (see below) to restore the cursor to its previous state.
  4115.  
  4116. Note:       HIDECURSOR can be called directly from QuickBASIC but, since
  4117.             the LOCATE statement provides an alternative means of turning
  4118.             off the cursor, it is not necessary.
  4119.  
  4120.  
  4121. SCREENADDRESS
  4122.  
  4123. Calculate screen address from a pair of row/column co-ordinates.
  4124.  
  4125.             extrn   ScreenAddress: far
  4126.  
  4127. Given the row/column column co-ordinate of a character on the screen, this
  4128. function returns the segment:offset address of that character in video
  4129. memory. The address is correctly adjusted to the start of the the
  4130. currently active display page, but no check is made to ensure that the
  4131. co-ordinates supplied are within the actual screen bounds.
  4132.  
  4133. Input:      AL      = Row co-ordinate of character (0 = row 1).
  4134.             AH      = Column co-ordinate of character (0 = column 1).
  4135.  
  4136. Output:     ES:DI==>  Address in video display buffer of the
  4137.                       character cell specified.
  4138.             DX      = CRT status register port address.
  4139.  
  4140. It is assumed that a previous call has been made to the VIDEOTYPE function
  4141. (see below), to determine the screen width, the port address of the CRT
  4142. status register and the correct video display segment. 
  4143.  
  4144.  
  4145. SCREENCOPY
  4146.  
  4147. Copy a character and attribute from the video display to a buffer at the
  4148. address specified.
  4149.  
  4150.             extrn   ScreenCopy: far
  4151.  
  4152. If the 'snow prevention' flag is set, this routine waits until the
  4153. beginning of the next CRT horizontal retrace period before reading data
  4154. from the display. This is necessary only on machines fitted with a Colour
  4155. Graphics Adaptor (CGA) which may suffer from glitches or screen snow if
  4156. data is copied from the screen while the video buffer is being refreshed.
  4157.  
  4158. Input:      DS:SI==>    Address of the screen location from which
  4159.                         the data is to be copied. 
  4160.             ES:DI==>    Address of the buffer into which the data
  4161.                         is to be copied.
  4162.             DX =        Port address of CRT status register.
  4163.  
  4164. Output:     SI and DI   Updated to point to next buffer locations.
  4165.             AX          destroyed.
  4166.  
  4167. It is assumed that a previous call has been made to the VIDEOTYPE function
  4168. (see below), to determine the screen width, the port address of the CRT
  4169. status register and the correct video display segment. VIDEOTYPE also sets
  4170. an internal 'snow-prevention' flag if the host machine has a CGA display
  4171. adaptor installed. This activates a routine which synchronises direct
  4172. video reads and writes to the CRT vertical retrace period, preventing
  4173. interference on the display.
  4174.  
  4175.  
  4176. SCREENREAD
  4177.  
  4178. Read a character and attribute from the display.
  4179.  
  4180.             extrn   ScreenRead: far
  4181.  
  4182. This procedure is similar to SCREENCOPY (see above), except that the word
  4183. is simply loaded into AX instead of being copied into a buffer.
  4184.  
  4185. Input:      DS:SI==>    address, in the video display buffer, from
  4186.                         where the data is to be read
  4187.             DX =        port address of the CRT status register.
  4188.  
  4189. Output:     AL =        character at the specified address
  4190.             AH =        display attribute given to character
  4191.             DI          updated to point to the next word address
  4192.  
  4193. It is assumed that a previous call has been made to the VIDEOTYPE function
  4194. (see below), to determine the screen width, the port address of the CRT
  4195. status register and the correct video display segment. VIDEOTYPE also sets
  4196. an internal 'snow-prevention' flag if the host machine has a CGA display
  4197. adaptor installed. This activates a routine which synchronises direct
  4198. video reads and writes to the CRT vertical retrace period, preventing
  4199. interference on the display.
  4200.  
  4201.  
  4202. SCREENWRITE
  4203.  
  4204. Output a character and attribute to the video display.
  4205.  
  4206.             extrn   ScreenWrite: far
  4207.  
  4208. If the 'snow prevention' flag is set, this routine waits until the
  4209. beginning of the next CRT horizontal retrace period before writing data to
  4210. the display. This is necessary only on machines fitted with a Colour
  4211. Graphics Adaptor (CGA) which may suffer from glitches or screen snow if
  4212. data is written to the screen while the video buffer is being refreshed.
  4213.  
  4214. Input:      ES:DI==>    Address in the video display buffer where
  4215.                         the data is to be written. 
  4216.             DX =        Port address of CRT status register.
  4217.             AL =        Character to output.
  4218.             AH =        Display attribute to set
  4219.  
  4220. Output:     DI          Updated to point to next output address.
  4221.  
  4222. It is assumed that a previous call has been made to the VIDEOTYPE function
  4223. (see below), to determine the screen width, the port address of the CRT
  4224. status register and the correct video display segment. VIDEOTYPE also sets
  4225. an internal 'snow-prevention' flag if the host machine has a CGA display
  4226. adaptor installed. This activates a routine which synchronises direct
  4227. video reads and writes to the CRT vertical retrace period, preventing
  4228. interference on the display.
  4229.  
  4230.  
  4231. SHOWCURSOR
  4232.  
  4233. Makes the cursor visible. No parameters are required or returned.
  4234.  
  4235.             extrn   ShowCursor: far
  4236.  
  4237. This method ANDs the byte value of the cursor start line with 31 (1F Hex)
  4238. which, restores the cursor after being made invisible by the HIDECURSOR
  4239. routine (see above).
  4240.  
  4241. Note:       SHOWCURSOR can be called directly from QuickBASIC but, since
  4242.             the LOCATE statement provides an alternative means of turning
  4243.             the cursor on and off, it is not needed in high-level code.
  4244.  
  4245.  
  4246. VIDEO
  4247.  
  4248. Video equipment check. This function returns information about the active
  4249. display adaptor installed in the host system.
  4250.  
  4251.             extrn   Video: far
  4252.  
  4253. No input parameters are required, on return AX should be examined for the
  4254. following values:
  4255.     
  4256.         AL = type of video adaptor installed
  4257.  
  4258.              1 = MDA   - Monochrome Display Adaptor
  4259.              2 = CGA   - Colour Graphics Adaptor
  4260.              3 = HGC   - Hercules Graphics Card
  4261.              4 = HGC+  - Hercules Graphics Card Plus
  4262.              5 = HIC   - Hercules InColour Card
  4263.              6 = EGA   - Extended Graphics Adaptor
  4264.              7 = PGA   - Professional Graphics Adaptor (IBM PS/2)
  4265.              8 = VGA   - Video Graphics Array
  4266.              9 = MCGA  - MultiColour Graphics Adaptor  (IBM PS/2)
  4267.  
  4268.         AH  (bits 0-6) = size of display memory in 16K blocks
  4269.                          (0 = <16K, 1 = 16K, 2 = 32K, etc.)
  4270.             (bit 7)    = type of display monitor in use
  4271.                          (0 = colour, 1 = monochrome) 
  4272.  
  4273.  
  4274. VIDEOTYPE
  4275.  
  4276. Collects information about the current video display and sets various
  4277. internal flags.
  4278.  
  4279.             extrn   VideoType: far
  4280.  
  4281. The correct video display segment and CRT status port addresses are
  4282. determined for the current system and, if necessary, the internal 'snow'
  4283. prevention flag is set.
  4284.  
  4285. Input:      nothing
  4286.  
  4287. Output:     AL =    Current display mode
  4288.             AH =    Screen width in columns
  4289.             BL =    Screen height in rows
  4290.             BH =    Active display page
  4291.  
  4292. You should make a preliminary call to this function before using any of
  4293. the other internal routines which directly access video memory.
  4294.  
  4295.  
  4296. WRITEBYTE
  4297.  
  4298. Output a byte of data to video memory.
  4299.  
  4300.             extrn   WriteByte: far
  4301.  
  4302. This procedure is similar to ScreenWrite, above, except that only a single
  4303. byte is written. It is used by the BackFill routine to reset the display
  4304. attribute of a character, without changing the character itself.
  4305.  
  4306. Input:      ES:DI==>    address, in the video display buffer, where
  4307.                         the byte is to be written.
  4308.             DX =        port address of the CRT status register.
  4309.             AL =        the byte value to be written.
  4310.  
  4311. Output:     DI          updated to point to the next byte address
  4312.  
  4313. It is assumed that a previous call has been made to the VIDEOTYPE function
  4314. (see above) to determine the screen width, the port address of the CRT
  4315. status register and the correct video display segment. VIDEOTYPE also sets
  4316. an internal 'snow-prevention' flag if the host machine has a CGA display
  4317. adaptor installed. This activates a routine which synchronises direct
  4318. video reads and writes to the CRT vertical retrace period, preventing
  4319. interference on the display.
  4320.  
  4321.  
  4322. ─────────────────────────────────────────────────────────────────────────
  4323.